class DNSServerFactoryTests(unittest.TestCase): (source)
Tests for server.DNSServerFactory
.
Method | test_allow |
If allowQuery returns False, server.DNSServerFactory.messageReceived calls server.sendReply with a message whose rCode is dns.EREFUSED . |
Method | test |
server.DNSServerFactory.__init__ accepts an authorities argument. The value of this argument is a list and is used to extend the resolver resolve.ResolverChain . |
Method | test_build |
server.DNSServerFactory.buildProtocol builds a protocol by calling server.DNSServerFactory.protocol with its self as a positional argument. |
Method | test_cache |
server.DNSServerFactory.cache is None by default. |
Method | test_cache |
server.DNSServerFactory.__init__ assigns the last object in the caches list to server.DNSServerFactory.cache . |
Method | test |
server.DNSServerFactory.__init__ accepts a caches argument. The value of this argument is a list and is used to extend the resolver resolve.ResolverChain . |
Method | test_can |
server.DNSServerFactory.canRecurse is a flag indicating that this server is capable of performing recursive DNS lookups. It defaults to False . |
Method | test_can |
server.DNSServerFactory.__init__ sets canRecurse to True if it is supplied with clients. |
Method | test |
server.DNSServerFactory.__init__ accepts a clients argument. The value of this argument is a list and is used to extend the resolver resolve.ResolverChain . |
Method | test_connection |
The connectionMade and connectionLost methods of DNSServerFactory cooperate to keep track of all DNSProtocol objects created by a factory which are connected. |
Method | test_default |
server.DNSServerFactory.protocol defaults to dns.DNSProtocol . |
Method | test_got |
server.DNSServerFactory.gotResolver triggers a response message with an rCode of dns.ENAME if supplied with a error.AuthoritativeDomainError . |
Method | test_got |
server.DNSServerFactory.gotResolverError calls server.DNSServerFactory._responseFromMessage to generate a response. |
Method | test_got |
server.DNSServerFactory.gotResolver triggers a response message with an rCode of dns.ENAME if supplied with a error.DomainError . |
Method | test_got |
server.DNSServerFactory.gotResolver logs a message if verbose > 0. |
Method | test_got |
server.DNSServerFactory.gotResolver triggers a response message with an rCode of dns.ESERVER if supplied with another type of error and logs the error. |
Method | test_got |
server.DNSServerFactory.gotResolverError does not allow request attributes to leak into the response ie it sends a response with AD, CD set to 0 and empty response record sections. |
Method | test_got |
server.DNSServerFactory.gotResolverResponse accepts a tuple of resource record lists and triggers a response message containing those resource record lists. |
Method | test_got |
server.DNSServerFactory.gotResolverResponse caches the response if at least one cache was provided in the constructor. |
Method | test_got |
server.DNSServerFactory.gotResolverResponse calls server.DNSServerFactory._responseFromMessage to generate a response. |
Method | test_got |
server.DNSServerFactory.gotResolverResponse logs the total number of records in the response if verbose > 0. |
Method | test_got |
server.DNSServerFactory.gotResolverResponse does not allow request attributes to leak into the response ie it sends a response with AD, CD set to 0 and none of the records in the request answer sections are copied to the response. |
Method | test_handle |
server.DNSServerFactory.handleInverseQuery triggers the sending of a response message with rCode set to dns.ENOTIMP . |
Method | test_handle |
server.DNSServerFactory.handleInverseQuery logs the message origin address if verbose > 0. |
Method | test_handle |
server.DNSServerFactory.handleNotify triggers the sending of a response message with rCode set to dns.ENOTIMP . |
Method | test_handle |
server.DNSServerFactory.handleNotify logs the message origin address if verbose > 0. |
Method | test_handle |
server.DNSServerFactory.handleOther triggers the sending of a response message with rCode set to dns.ENOTIMP . |
Method | test_handle |
server.DNSServerFactory.handleOther logs the message origin address if verbose > 0. |
Method | test_handle |
server.DNSServerFactory.handleQuery takes the first query from the supplied message and dispatches it to server.DNSServerFactory.resolver.query . |
Method | test_handle |
server.DNSServerFactory.handleQuery adds server.DNSServerFactory.resolver.gotResolverResponse as a callback to the deferred returned by server.DNSServerFactory.resolver.query . It is called with the query response, the original protocol, message and origin address. |
Method | test_handle |
server.DNSServerFactory.handleQuery adds server.DNSServerFactory.resolver.gotResolverError as an errback to the deferred returned by server.DNSServerFactory.resolver.query . It is called with the query failure, the original protocol, message and origin address. |
Method | test_handle |
server.DNSServerFactory.handleStatus triggers the sending of a response message with rCode set to dns.ENOTIMP . |
Method | test_handle |
server.DNSServerFactory.handleStatus logs the message origin address if verbose > 0. |
Method | test |
server.DNSServerFactory implements IProtocolFactory . |
Method | test_inverse |
DNSServerFactory.messageReceived passes messages with an opcode of OP_INVERSE on to DNSServerFactory.handleInverseQuery . |
Method | test_message |
server.DNSServerFactory has a _messageFactory attribute which is dns.Message by default. |
Method | test_message |
server.DNSServerFactory.messageReceived passes all messages to server.DNSServerFactory.allowQuery along with the receiving protocol and origin address. |
Method | test_message |
server.DNSServerFactory.messageReceived logs the query types of all queries in the message if verbose is set to 1. |
Method | test_message |
server.DNSServerFactory.messageReceived logs the repr of all queries in the message if verbose is set to 2. |
Method | test_message |
server.DNSServerFactory.messageReceived logs about an empty query if the message had no queries and verbose is >0. |
Method | test_message |
server.DNSServerFactory.messageReceived assigns a unix timestamp to the received message. |
Method | test_notify |
DNSServerFactory.messageReceived passes messages with an opcode of OP_NOTIFY on to DNSServerFactory.handleNotify . |
Method | test_query |
DNSServerFactory.messageReceived passes messages with an opcode of OP_QUERY on to DNSServerFactory.handleQuery . |
Method | test_resolver |
server.DNSServerFactory.resolver is an empty resolve.ResolverChain by default. |
Method | test_resolver |
server.DNSServerFactory.resolver contains an ordered list of authorities, caches and clients. |
Method | test_resolver |
server.DNSServerFactory.resolver is a resolve.ResolverChain instance |
Method | test_response |
server.DNSServerFactory._responseFromMessage marks the response message as authoritative if any of the answer records are authoritative. |
Method | test_response |
server.DNSServerFactory._responseFromMessage calls dns._responseFromMessage to generate a response message from the request message. It supplies the request message and other keyword arguments which should be passed to the response message initialiser. |
Method | test_response |
server.DNSServerFactory._responseFromMessage generates a response message whose maxSize attribute has the same value as that found on the request. |
Method | test_response |
server.DNSServerFactory._responseFromMessage generates a response message which is a copy of the request message. |
Method | test_response |
server.DNSServerFactory._responseFromMessage generates a response message whose recAV attribute is True if server.DNSServerFactory.canRecurse is True . |
Method | test_response |
server.DNSServerFactory._responseFromMessage generates a response message whose timeReceived attribute has the same value as that found on the request. |
Method | test_send |
If server.DNSServerFactory.sendReply logs a "no answers" message if the supplied message has no answers. |
Method | test_send |
If server.DNSServerFactory.sendReply logs a message for answers, authority, additional if the supplied a message has records in any of those sections. |
Method | test_send |
If server.DNSServerFactory.sendReply is supplied with a protocol *and* an address tuple it will supply that address to protocol.writeMessage. |
Method | test_send |
If server.DNSServerFactory.sendReply is supplied with a protocol but no address tuple it will supply only a message to protocol.writeMessage. |
Method | test_status |
DNSServerFactory.messageReceived passes messages with an opcode of OP_STATUS on to DNSServerFactory.handleStatus . |
Method | test_update |
DNSServerFactory.messageReceived passes messages with an opcode of OP_UPDATE on to DNSServerFactory.handleOther . |
Method | test_verbose |
server.DNSServerFactory.verbose defaults to False . |
Method | test_verbose |
server.DNSServerFactory._verboseLog does not log messages unless verbose > 0. |
Method | test_verbose |
server.DNSServerFactory._verboseLog logs a message if verbose > 0. |
Method | test_verbose |
server.DNSServerFactory.__init__ accepts a verbose argument which overrides server.DNSServerFactory.verbose . |
Method | _assert |
server.DNSServerFactory.gotResolver accepts a failure.Failure and triggers a response message whose rCode corresponds to the DNS error contained in the Failure. |
Method | _message |
Assert that the named method is called with the given message when it is passed to DNSServerFactory.messageReceived . |
Inherited from TestCase
:
Method | __call__ |
Run the test. Should always do exactly the same thing as run(). |
Method | __init__ |
Construct an asynchronous test case for methodName. |
Method | add |
Extend the base cleanup feature with support for cleanup functions which return Deferreds. |
Method | assert |
Fail if deferred does not errback with one of expectedFailures. Returns the original Deferred with callbacks added. You will need to return this Deferred from your test case. |
Method | defer |
Run any scheduled cleanups and report errors (if any) to the result. object. |
Method | defer |
Undocumented |
Method | defer |
Undocumented |
Method | defer |
Undocumented |
Method | get |
Undocumented |
Method | get |
Returns the timeout value set on this test. Checks on the instance first, then the class, then the module, then packages. As soon as it finds something with a timeout attribute, returns that. Returns util.DEFAULT_TIMEOUT_DURATION ... |
Instance Variable | timeout |
A real number of seconds. If set, the test will raise an error if it takes longer than timeout seconds. If not set, util.DEFAULT_TIMEOUT_DURATION is used. |
Method | _cb |
Undocumented |
Method | _class |
Undocumented |
Method | _clean |
Undocumented |
Method | _deprecate |
Deprecate iterate, crash and stop on reactor. That is, each method is wrapped in a function that issues a deprecation warning, then calls the original. |
Method | _eb |
Undocumented |
Method | _eb |
Undocumented |
Method | _eb |
Undocumented |
Method | _make |
Create a method which wraps the reactor method name. The new method issues a deprecation warning and calls the original. |
Method | _run |
Run a single method, either a test method or fixture. |
Method | _run |
Really run setUp, the test method, and tearDown. Any of these may return defer.Deferred s. After they complete, do some reactor cleanup. |
Method | _undeprecate |
Restore the deprecated reactor methods. Undoes what _deprecateReactor did. |
Method | _wait |
Take a Deferred that only ever callbacks. Block until it happens. |
Instance Variable | _passed |
Undocumented |
Instance Variable | _reactor |
Undocumented |
Instance Variable | _timed |
Undocumented |
Inherited from SynchronousTestCase
(via TestCase
):
Method | __eq__ |
Override the comparison defined by the base TestCase which considers instances of the same class with the same _testMethodName to be equal. Since trial puts TestCase instances into a set, that definition of comparison makes it impossible to run the same test method twice... |
Method | __hash__ |
Undocumented |
Method | call |
Call a function that should have been deprecated at a specific version and in favor of a specific alternative, and assert that it was thusly deprecated. |
Method | flush |
Remove stored errors received from the log. |
Method | flush |
Remove stored warnings from the list of captured warnings and return them. |
Method | get |
Retrieve a module attribute which should have been deprecated, and assert that we saw the appropriate deprecation warning. |
Method | get |
Return the skip reason set on this test, if any is set. Checks on the instance first, then the class, then the module, then packages. As soon as it finds something with a skip attribute, returns that in a tuple (... |
Method | get |
Return a Todo object if the test is marked todo. Checks on the instance first, then the class, then the module, then packages. As soon as it finds something with a todo attribute, returns that. Returns ... |
Method | mktemp |
Create a new path name which can be used for a new file or directory. |
Method | patch |
Monkey patch an object for the duration of the test. |
Method | run |
Run the test case, storing the results in result. |
Method | run |
If no methodName argument is passed to the constructor, run will treat this method as the thing with the actual test inside. |
Method | short |
Undocumented |
Instance Variable | failure |
An exception class, defaulting to FailTest. If the test method raises this exception, it will be reported as a failure, rather than an exception. All of the assertion methods raise this if the assertion fails. |
Instance Variable | skip |
None or a string explaining why this test is to be skipped. If defined, the test will not be run. Instead, it will be reported to the result object as 'skipped' (if the TestResult supports skipping). |
Instance Variable | suppress |
None or a list of tuples of (args, kwargs) to be passed to warnings.filterwarnings. Use these to suppress warnings raised in a test. Useful for testing deprecated code. See also util.suppress . |
Instance Variable | todo |
None , a string or a tuple of (errors, reason) where errors is either an exception class or an iterable of exception classes, and reason is a string. See Todo or makeTodo for more information. |
Method | _get |
Return the reason to use for skipping a test method. |
Method | _get |
Returns any warning suppressions set for this test. Checks on the instance first, then the class, then the module, then packages. As soon as it finds something with a suppress attribute, returns that. ... |
Method | _install |
Undocumented |
Method | _remove |
Undocumented |
Method | _run |
Synchronously run any cleanups which have been added. |
Instance Variable | _cleanups |
Undocumented |
Instance Variable | _observer |
Undocumented |
Instance Variable | _parents |
Undocumented |
Instance Variable | _test |
Undocumented |
Instance Variable | _warnings |
Undocumented |
Inherited from _Assertions
(via TestCase
, SynchronousTestCase
):
Method | assert |
Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. |
Method | assert |
Fail if first - second > tolerance |
Method | assert |
Fail the test if first and second are not equal. |
Method | assert |
Fail the test if condition evaluates to True. |
Method | assert |
Fail the test if containee is not found in container. |
Method | assert |
Fail the test if first is not second. This is an obect-identity-equality test, not an object equality (i.e. __eq__) test. |
Method | assert |
Fail if instance is not an instance of the given class or of one of the given classes. |
Method | assert |
Fail the test if first is second. This is an obect-identity-equality test, not an object equality (i.e. __eq__) test. |
Method | assert |
Assert that deferred does not have a result at this point. |
Method | assert |
Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. |
Method | assert |
Fail the test if first == second. |
Method | assert |
Fail the test if containee is found in container. |
Method | assert |
Fail if instance is an instance of the given class or of one of the given classes. |
Method | assert |
Fail if astring contains substring. |
Method | assert |
Fail the test unless calling the function f with the given args and kwargs raises exception. The failure will report the traceback and call stack of the unexpected exception. |
Method | assert |
Fail if substring does not exist within astring. |
Method | assert |
Fail the test if condition evaluates to False. |
Method | assert |
Fail if the given function doesn't generate the specified warning when called. It calls the function, checks the warning, and forwards the result of the function if everything is fine. |
Method | fail |
Absolutely fail the test. Do not pass go, do not collect $200. |
Method | failure |
Return the current failure result of deferred or raise self.failureException. |
Method | success |
Return the current success result of deferred or raise self.failureException. |
If allowQuery returns False, server.DNSServerFactory.messageReceived
calls server.sendReply
with a message whose rCode is dns.EREFUSED
.
server.DNSServerFactory.__init__
accepts an authorities argument. The value of this argument is a list and is used to extend the resolver resolve.ResolverChain
.
server.DNSServerFactory.buildProtocol
builds a protocol by calling server.DNSServerFactory.protocol
with its self as a positional argument.
server.DNSServerFactory.__init__
assigns the last object in the caches list to server.DNSServerFactory.cache
.
server.DNSServerFactory.__init__
accepts a caches argument. The value of this argument is a list and is used to extend the resolver resolve.ResolverChain
.
server.DNSServerFactory.canRecurse
is a flag indicating that this server is capable of performing recursive DNS lookups. It defaults to False
.
server.DNSServerFactory.__init__
accepts a clients argument. The value of this argument is a list and is used to extend the resolver resolve.ResolverChain
.
The connectionMade and connectionLost methods of DNSServerFactory
cooperate to keep track of all DNSProtocol
objects created by a factory which are connected.
server.DNSServerFactory.gotResolver
triggers a response message with an rCode of dns.ENAME
if supplied with a error.AuthoritativeDomainError
.
server.DNSServerFactory.gotResolverError
calls server.DNSServerFactory._responseFromMessage
to generate a response.
server.DNSServerFactory.gotResolver
triggers a response message with an rCode of dns.ENAME
if supplied with a error.DomainError
.
server.DNSServerFactory.gotResolver
triggers a response message with an rCode of dns.ESERVER
if supplied with another type of error and logs the error.
server.DNSServerFactory.gotResolverError
does not allow request attributes to leak into the response ie it sends a response with AD, CD set to 0 and empty response record sections.
server.DNSServerFactory.gotResolverResponse
accepts a tuple of resource record lists and triggers a response message containing those resource record lists.
server.DNSServerFactory.gotResolverResponse
caches the response if at least one cache was provided in the constructor.
server.DNSServerFactory.gotResolverResponse
calls server.DNSServerFactory._responseFromMessage
to generate a response.
server.DNSServerFactory.gotResolverResponse
logs the total number of records in the response if verbose > 0.
server.DNSServerFactory.gotResolverResponse
does not allow request attributes to leak into the response ie it sends a response with AD, CD set to 0 and none of the records in the request answer sections are copied to the response.
server.DNSServerFactory.handleInverseQuery
triggers the sending of a response message with rCode set to dns.ENOTIMP
.
server.DNSServerFactory.handleNotify
triggers the sending of a response message with rCode set to dns.ENOTIMP
.
server.DNSServerFactory.handleOther
triggers the sending of a response message with rCode set to dns.ENOTIMP
.
server.DNSServerFactory.handleQuery
takes the first query from the supplied message and dispatches it to server.DNSServerFactory.resolver.query
.
server.DNSServerFactory.handleQuery
adds server.DNSServerFactory.resolver.gotResolverResponse
as a callback to the deferred returned by server.DNSServerFactory.resolver.query
. It is called with the query response, the original protocol, message and origin address.
server.DNSServerFactory.handleQuery
adds server.DNSServerFactory.resolver.gotResolverError
as an errback to the deferred returned by server.DNSServerFactory.resolver.query
. It is called with the query failure, the original protocol, message and origin address.
server.DNSServerFactory.handleStatus
triggers the sending of a response message with rCode set to dns.ENOTIMP
.
DNSServerFactory.messageReceived
passes messages with an opcode of OP_INVERSE on to DNSServerFactory.handleInverseQuery
.
server.DNSServerFactory.messageReceived
passes all messages to server.DNSServerFactory.allowQuery
along with the receiving protocol and origin address.
server.DNSServerFactory.messageReceived
logs the query types of all queries in the message if verbose is set to 1.
server.DNSServerFactory.messageReceived
logs the repr of all queries in the message if verbose is set to 2.
server.DNSServerFactory.messageReceived
logs about an empty query if the message had no queries and verbose is >0.
DNSServerFactory.messageReceived
passes messages with an opcode of OP_NOTIFY on to DNSServerFactory.handleNotify
.
DNSServerFactory.messageReceived
passes messages with an opcode of OP_QUERY on to DNSServerFactory.handleQuery
.
server.DNSServerFactory._responseFromMessage
marks the response message as authoritative if any of the answer records are authoritative.
server.DNSServerFactory._responseFromMessage
calls dns._responseFromMessage to generate a response message from the request message. It supplies the request message and other keyword arguments which should be passed to the response message initialiser.
server.DNSServerFactory._responseFromMessage
generates a response message whose maxSize attribute has the same value as that found on the request.
server.DNSServerFactory._responseFromMessage
generates a response message which is a copy of the request message.
server.DNSServerFactory._responseFromMessage
generates a response message whose recAV attribute is True
if server.DNSServerFactory.canRecurse
is True
.
server.DNSServerFactory._responseFromMessage
generates a response message whose timeReceived attribute has the same value as that found on the request.
If server.DNSServerFactory.sendReply
logs a "no answers" message if the supplied message has no answers.
If server.DNSServerFactory.sendReply
logs a message for answers, authority, additional if the supplied a message has records in any of those sections.
If server.DNSServerFactory.sendReply
is supplied with a protocol *and* an address tuple it will supply that address to protocol.writeMessage.
If server.DNSServerFactory.sendReply
is supplied with a protocol but no address tuple it will supply only a message to protocol.writeMessage.
DNSServerFactory.messageReceived
passes messages with an opcode of OP_STATUS on to DNSServerFactory.handleStatus
.
DNSServerFactory.messageReceived
passes messages with an opcode of OP_UPDATE on to DNSServerFactory.handleOther
.
This may change if the implementation ever covers update messages.
server.DNSServerFactory.__init__
accepts a verbose argument which overrides server.DNSServerFactory.verbose
.
server.DNSServerFactory.gotResolver
accepts a failure.Failure
and triggers a response message whose rCode corresponds to the DNS error contained in the Failure.
Parameters | |
responseException | The Exception instance which is expected to trigger expectedMessageCode when it is supplied to gotResolverError |
expectedint | The rCode which is expected in the message returned by gotResolverError in response to responseError. |
Assert that the named method is called with the given message when it is passed to DNSServerFactory.messageReceived
.
Parameters | |
methodstr | The name of the method which is expected to be called. |
message:dns.Message | The message which is expected to be passed to the methodName method. |