Tests for server.DNSServerFactory.

Method test_resolverType server.DNSServerFactory.resolver is a resolve.ResolverChain instance
Method test_resolverDefaultEmpty server.DNSServerFactory.resolver is an empty resolve.ResolverChain by default.
Method test_authorities 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_caches 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_clients 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_resolverOrder server.DNSServerFactory.resolver contains an ordered list of authorities, caches and clients.
Method test_cacheDefault server.DNSServerFactory.cache is None by default.
Method test_cacheOverride server.DNSServerFactory.__init__ assigns the last object in the caches list to server.DNSServerFactory.cache.
Method test_canRecurseDefault server.DNSServerFactory.canRecurse is a flag indicating that this server is capable of performing recursive DNS lookups. It defaults to False.
Method test_canRecurseOverride server.DNSServerFactory.__init__ sets canRecurse to True if it is supplied with clients.
Method test_verboseDefault server.DNSServerFactory.verbose defaults to False.
Method test_verboseOverride server.DNSServerFactory.__init__ accepts a verbose argument which overrides server.DNSServerFactory.verbose.
Method test_interface server.DNSServerFactory implements IProtocolFactory.
Method test_defaultProtocol server.DNSServerFactory.protocol defaults to dns.DNSProtocol.
Method test_buildProtocolProtocolOverride server.DNSServerFactory.buildProtocol builds a protocol by calling server.DNSServerFactory.protocol with its self as a positional argument.
Method test_verboseLogQuiet server.DNSServerFactory._verboseLog does not log messages unless verbose > 0.
Method test_verboseLogVerbose server.DNSServerFactory._verboseLog logs a message if verbose > 0.
Method test_messageReceivedLoggingNoQuery server.DNSServerFactory.messageReceived logs about an empty query if the message had no queries and verbose is >0.
Method test_messageReceivedLogging1 server.DNSServerFactory.messageReceived logs the query types of all queries in the message if verbose is set to 1.
Method test_messageReceivedLogging2 server.DNSServerFactory.messageReceived logs the repr of all queries in the message if verbose is set to 2.
Method test_messageReceivedTimestamp server.DNSServerFactory.messageReceived assigns a unix timestamp to the received message.
Method test_messageReceivedAllowQuery server.DNSServerFactory.messageReceived passes all messages to server.DNSServerFactory.allowQuery along with the receiving protocol and origin address.
Method test_allowQueryFalse If allowQuery returns False, server.DNSServerFactory.messageReceived calls server.sendReply with a message whose rCode is dns.EREFUSED.
Method test_queryMessageReceived DNSServerFactory.messageReceived passes messages with an opcode of OP_QUERY on to DNSServerFactory.handleQuery.
Method test_inverseQueryMessageReceived DNSServerFactory.messageReceived passes messages with an opcode of OP_INVERSE on to DNSServerFactory.handleInverseQuery.
Method test_statusMessageReceived DNSServerFactory.messageReceived passes messages with an opcode of OP_STATUS on to DNSServerFactory.handleStatus.
Method test_notifyMessageReceived DNSServerFactory.messageReceived passes messages with an opcode of OP_NOTIFY on to DNSServerFactory.handleNotify.
Method test_updateMessageReceived DNSServerFactory.messageReceived passes messages with an opcode of OP_UPDATE on to DNSServerFactory.handleOther.
Method test_connectionTracking The connectionMade and connectionLost methods of DNSServerFactory cooperate to keep track of all DNSProtocol objects created by a factory which are connected.
Method test_handleQuery server.DNSServerFactory.handleQuery takes the first query from the supplied message and dispatches it to server.DNSServerFactory.resolver.query.
Method test_handleQueryCallback No summary
Method test_handleQueryErrback No summary
Method test_gotResolverResponse server.DNSServerFactory.gotResolverResponse accepts a tuple of resource record lists and triggers a response message containing those resource record lists.
Method test_gotResolverResponseCallsResponseFromMessage server.DNSServerFactory.gotResolverResponse calls server.DNSServerFactory._responseFromMessage to generate a response.
Method test_responseFromMessageNewMessage server.DNSServerFactory._responseFromMessage generates a response message which is a copy of the request message.
Method test_responseFromMessageRecursionAvailable server.DNSServerFactory._responseFromMessage generates a response message whose recAV attribute is True if server.DNSServerFactory.canRecurse is True.
Method test_responseFromMessageTimeReceived server.DNSServerFactory._responseFromMessage generates a response message whose timeReceived attribute has the same value as that found on the request.
Method test_responseFromMessageMaxSize server.DNSServerFactory._responseFromMessage generates a response message whose maxSize attribute has the same value as that found on the request.
Method test_messageFactory server.DNSServerFactory has a _messageFactory attribute which is dns.Message by default.
Method test_responseFromMessageCallsMessageFactory No summary
Method test_responseFromMessageAuthoritativeMessage server.DNSServerFactory._responseFromMessage marks the response message as authoritative if any of the answer records are authoritative.
Method test_gotResolverResponseLogging server.DNSServerFactory.gotResolverResponse logs the total number of records in the response if verbose > 0.
Method test_gotResolverResponseCaching server.DNSServerFactory.gotResolverResponse caches the response if at least one cache was provided in the constructor.
Method test_gotResolverErrorCallsResponseFromMessage server.DNSServerFactory.gotResolverError calls server.DNSServerFactory._responseFromMessage to generate a response.
Method test_gotResolverErrorDomainError server.DNSServerFactory.gotResolver triggers a response message with an rCode of dns.ENAME if supplied with a error.DomainError.
Method test_gotResolverErrorAuthoritativeDomainError server.DNSServerFactory.gotResolver triggers a response message with an rCode of dns.ENAME if supplied with a error.AuthoritativeDomainError.
Method test_gotResolverErrorOtherError 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_gotResolverErrorLogging server.DNSServerFactory.gotResolver logs a message if verbose > 0.
Method test_gotResolverErrorResetsResponseAttributes 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_gotResolverResponseResetsResponseAttributes No summary
Method test_sendReplyWithAddress If server.DNSServerFactory.sendReply is supplied with a protocol *and* an address tuple it will supply that address to protocol.writeMessage.
Method test_sendReplyWithoutAddress If server.DNSServerFactory.sendReply is supplied with a protocol but no address tuple it will supply only a message to protocol.writeMessage.
Method test_sendReplyLoggingNoAnswers If server.DNSServerFactory.sendReply logs a "no answers" message if the supplied message has no answers.
Method test_sendReplyLoggingWithAnswers 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_handleInverseQuery server.DNSServerFactory.handleInverseQuery triggers the sending of a response message with rCode set to dns.ENOTIMP.
Method test_handleInverseQueryLogging server.DNSServerFactory.handleInverseQuery logs the message origin address if verbose > 0.
Method test_handleStatus server.DNSServerFactory.handleStatus triggers the sending of a response message with rCode set to dns.ENOTIMP.
Method test_handleStatusLogging server.DNSServerFactory.handleStatus logs the message origin address if verbose > 0.
Method test_handleNotify server.DNSServerFactory.handleNotify triggers the sending of a response message with rCode set to dns.ENOTIMP.
Method test_handleNotifyLogging server.DNSServerFactory.handleNotify logs the message origin address if verbose > 0.
Method test_handleOther server.DNSServerFactory.handleOther triggers the sending of a response message with rCode set to dns.ENOTIMP.
Method test_handleOtherLogging server.DNSServerFactory.handleOther logs the message origin address if verbose > 0.
Method _messageReceivedTest Assert that the named method is called with the given message when it is passed to DNSServerFactory.messageReceived.
Method _assertMessageRcodeForError server.DNSServerFactory.gotResolver accepts a failure.Failure and triggers a response message whose rCode corresponds to the DNS error contained in the Failure.

Inherited from TestCase:

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 __init__ Construct an asynchronous test case for methodName.
Method assertFailure 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 __call__ Run the test. Should always do exactly the same thing as run().
Method deferSetUp Undocumented
Method deferTestMethod Undocumented
Method deferTearDown Undocumented
Method deferRunCleanups Run any scheduled cleanups and report errors (if any to the result object.
Method addCleanup Extend the base cleanup feature with support for cleanup functions which return Deferreds.
Method getSuppress Undocumented
Method getTimeout No summary
Method _run Run a single method, either a test method or fixture.
Method _ebDeferSetUp Undocumented
Method _cbDeferTestMethod Undocumented
Method _ebDeferTestMethod Undocumented
Method _ebDeferTearDown Undocumented
Method _cbDeferRunCleanups Undocumented
Method _cleanUp Undocumented
Method _classCleanUp Undocumented
Method _makeReactorMethod Create a method which wraps the reactor method name. The new method issues a deprecation warning and calls the original.
Method _deprecateReactor 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 _undeprecateReactor Restore the deprecated reactor methods. Undoes what _deprecateReactor did.
Method _runCleanups Run the cleanups added with addCleanup in order.
Method _runFixturesAndTest Really run setUp, the test method, and tearDown. Any of these may return defer.Deferreds. After they complete, do some reactor cleanup.
Method _wait Take a Deferred that only ever callbacks. Block until it happens.

Inherited from SynchronousTestCase (via TestCase):

Instance Variable failureException 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 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.
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.
Method __eq__ No summary
Method __ne__ Undocumented
Method __hash__ Undocumented
Method shortDescription Undocumented
Method getSkip No summary
Method getTodo No summary
Method runTest If no methodName argument is passed to the constructor, run will treat this method as the thing with the actual test inside.
Method run Run the test case, storing the results in result.
Method patch Monkey patch an object for the duration of the test.
Method flushLoggedErrors Remove stored errors received from the log.
Method flushWarnings Remove stored warnings from the list of captured warnings and return them.
Method callDeprecated 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 mktemp Create a new path name which can be used for a new file or directory.
Method _getSuppress No summary
Method _getSkipReason Return the reason to use for skipping a test method.
Method _installObserver Undocumented
Method _removeObserver Undocumented

Inherited from _Assertions (via TestCase, SynchronousTestCase):

Method fail Absolutely fail the test. Do not pass go, do not collect $200.
Method assertFalse Fail the test if condition evaluates to True.
Method assertTrue Fail the test if condition evaluates to False.
Method assertRaises 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 assertEqual Fail the test if first and second are not equal.
Method assertIs Fail the test if first is not second. This is an obect-identity-equality test, not an object equality (i.e. __eq__) test.
Method assertIsNot Fail the test if first is second. This is an obect-identity-equality test, not an object equality (i.e. __eq__) test.
Method assertNotEqual Fail the test if first == second.
Method assertIn Fail the test if containee is not found in container.
Method assertNotIn Fail the test if containee is found in container.
Method assertNotAlmostEqual 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 assertAlmostEqual 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 assertApproximates Fail if first - second > tolerance
Method assertSubstring Fail if substring does not exist within astring.
Method assertNotSubstring Fail if astring contains substring.
Method assertWarns 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 assertIsInstance Fail if instance is not an instance of the given class or of one of the given classes.
Method assertNotIsInstance Fail if instance is an instance of the given class or of one of the given classes.
Method successResultOf Return the current success result of deferred or raise self.failureException.
Method failureResultOf Return the current failure result of deferred or raise self.failureException.
Method assertNoResult Assert that deferred does not have a result at this point.
Method assertRegex Fail the test if a regexp search of text fails.
def test_resolverType(self):
def test_resolverDefaultEmpty(self):
def test_authorities(self):

server.DNSServerFactory.__init__ accepts an authorities argument. The value of this argument is a list and is used to extend the resolver resolve.ResolverChain.

def test_caches(self):

server.DNSServerFactory.__init__ accepts a caches argument. The value of this argument is a list and is used to extend the resolver resolve.ResolverChain.

def test_clients(self):

server.DNSServerFactory.__init__ accepts a clients argument. The value of this argument is a list and is used to extend the resolver resolve.ResolverChain.

def test_resolverOrder(self):

server.DNSServerFactory.resolver contains an ordered list of authorities, caches and clients.

def test_cacheDefault(self):
def test_cacheOverride(self):

server.DNSServerFactory.__init__ assigns the last object in the caches list to server.DNSServerFactory.cache.

def test_canRecurseDefault(self):

server.DNSServerFactory.canRecurse is a flag indicating that this server is capable of performing recursive DNS lookups. It defaults to False.

def test_canRecurseOverride(self):

server.DNSServerFactory.__init__ sets canRecurse to True if it is supplied with clients.

def test_verboseDefault(self):
def test_verboseOverride(self):

server.DNSServerFactory.__init__ accepts a verbose argument which overrides server.DNSServerFactory.verbose.

def test_interface(self):
def test_defaultProtocol(self):
def test_buildProtocolProtocolOverride(self):

server.DNSServerFactory.buildProtocol builds a protocol by calling server.DNSServerFactory.protocol with its self as a positional argument.

def test_verboseLogQuiet(self):

server.DNSServerFactory._verboseLog does not log messages unless verbose > 0.

def test_verboseLogVerbose(self):

server.DNSServerFactory._verboseLog logs a message if verbose > 0.

def test_messageReceivedLoggingNoQuery(self):

server.DNSServerFactory.messageReceived logs about an empty query if the message had no queries and verbose is >0.

def test_messageReceivedLogging1(self):

server.DNSServerFactory.messageReceived logs the query types of all queries in the message if verbose is set to 1.

def test_messageReceivedLogging2(self):

server.DNSServerFactory.messageReceived logs the repr of all queries in the message if verbose is set to 2.

def test_messageReceivedTimestamp(self):

server.DNSServerFactory.messageReceived assigns a unix timestamp to the received message.

def test_messageReceivedAllowQuery(self):

server.DNSServerFactory.messageReceived passes all messages to server.DNSServerFactory.allowQuery along with the receiving protocol and origin address.

def test_allowQueryFalse(self):

If allowQuery returns False, server.DNSServerFactory.messageReceived calls server.sendReply with a message whose rCode is dns.EREFUSED.

def _messageReceivedTest(self, methodName, message):

Assert that the named method is called with the given message when it is passed to DNSServerFactory.messageReceived.

ParametersmethodNameThe name of the method which is expected to be called. (type: str)
messageThe message which is expected to be passed to the methodName method. (type: dns.Message)
def test_queryMessageReceived(self):

DNSServerFactory.messageReceived passes messages with an opcode of OP_QUERY on to DNSServerFactory.handleQuery.

def test_inverseQueryMessageReceived(self):

DNSServerFactory.messageReceived passes messages with an opcode of OP_INVERSE on to DNSServerFactory.handleInverseQuery.

def test_statusMessageReceived(self):

DNSServerFactory.messageReceived passes messages with an opcode of OP_STATUS on to DNSServerFactory.handleStatus.

def test_notifyMessageReceived(self):

DNSServerFactory.messageReceived passes messages with an opcode of OP_NOTIFY on to DNSServerFactory.handleNotify.

def test_updateMessageReceived(self):

DNSServerFactory.messageReceived passes messages with an opcode of OP_UPDATE on to DNSServerFactory.handleOther.

This may change if the implementation ever covers update messages.

def test_connectionTracking(self):

The connectionMade and connectionLost methods of DNSServerFactory cooperate to keep track of all DNSProtocol objects created by a factory which are connected.

def test_handleQuery(self):

server.DNSServerFactory.handleQuery takes the first query from the supplied message and dispatches it to server.DNSServerFactory.resolver.query.

def test_handleQueryCallback(self):

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.

def test_handleQueryErrback(self):

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.

def test_gotResolverResponse(self):

server.DNSServerFactory.gotResolverResponse accepts a tuple of resource record lists and triggers a response message containing those resource record lists.

def test_gotResolverResponseCallsResponseFromMessage(self):
def test_responseFromMessageNewMessage(self):

server.DNSServerFactory._responseFromMessage generates a response message which is a copy of the request message.

def test_responseFromMessageRecursionAvailable(self):

server.DNSServerFactory._responseFromMessage generates a response message whose recAV attribute is True if server.DNSServerFactory.canRecurse is True.

def test_responseFromMessageTimeReceived(self):

server.DNSServerFactory._responseFromMessage generates a response message whose timeReceived attribute has the same value as that found on the request.

def test_responseFromMessageMaxSize(self):

server.DNSServerFactory._responseFromMessage generates a response message whose maxSize attribute has the same value as that found on the request.

def test_messageFactory(self):

server.DNSServerFactory has a _messageFactory attribute which is dns.Message by default.

def test_responseFromMessageCallsMessageFactory(self):

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.

def test_responseFromMessageAuthoritativeMessage(self):

server.DNSServerFactory._responseFromMessage marks the response message as authoritative if any of the answer records are authoritative.

def test_gotResolverResponseLogging(self):

server.DNSServerFactory.gotResolverResponse logs the total number of records in the response if verbose > 0.

def test_gotResolverResponseCaching(self):

server.DNSServerFactory.gotResolverResponse caches the response if at least one cache was provided in the constructor.

def test_gotResolverErrorCallsResponseFromMessage(self):
def _assertMessageRcodeForError(self, responseError, expectedMessageCode):

server.DNSServerFactory.gotResolver accepts a failure.Failure and triggers a response message whose rCode corresponds to the DNS error contained in the Failure.

ParametersresponseErrorThe Exception instance which is expected to trigger expectedMessageCode when it is supplied to gotResolverError (type: Exception)
expectedMessageCodeThe rCode which is expected in the message returned by gotResolverError in response to responseError. (type: int)
def test_gotResolverErrorDomainError(self):

server.DNSServerFactory.gotResolver triggers a response message with an rCode of dns.ENAME if supplied with a error.DomainError.

def test_gotResolverErrorAuthoritativeDomainError(self):

server.DNSServerFactory.gotResolver triggers a response message with an rCode of dns.ENAME if supplied with a error.AuthoritativeDomainError.

def test_gotResolverErrorOtherError(self):

server.DNSServerFactory.gotResolver triggers a response message with an rCode of dns.ESERVER if supplied with another type of error and logs the error.

def test_gotResolverErrorLogging(self):

server.DNSServerFactory.gotResolver logs a message if verbose > 0.

def test_gotResolverErrorResetsResponseAttributes(self):

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.

def test_gotResolverResponseResetsResponseAttributes(self):

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.

def test_sendReplyWithAddress(self):

If server.DNSServerFactory.sendReply is supplied with a protocol *and* an address tuple it will supply that address to protocol.writeMessage.

def test_sendReplyWithoutAddress(self):

If server.DNSServerFactory.sendReply is supplied with a protocol but no address tuple it will supply only a message to protocol.writeMessage.

def test_sendReplyLoggingNoAnswers(self):

If server.DNSServerFactory.sendReply logs a "no answers" message if the supplied message has no answers.

def test_sendReplyLoggingWithAnswers(self):

If server.DNSServerFactory.sendReply logs a message for answers, authority, additional if the supplied a message has records in any of those sections.

def test_handleInverseQuery(self):

server.DNSServerFactory.handleInverseQuery triggers the sending of a response message with rCode set to dns.ENOTIMP.

def test_handleInverseQueryLogging(self):

server.DNSServerFactory.handleInverseQuery logs the message origin address if verbose > 0.

def test_handleStatus(self):

server.DNSServerFactory.handleStatus triggers the sending of a response message with rCode set to dns.ENOTIMP.

def test_handleStatusLogging(self):

server.DNSServerFactory.handleStatus logs the message origin address if verbose > 0.

def test_handleNotify(self):

server.DNSServerFactory.handleNotify triggers the sending of a response message with rCode set to dns.ENOTIMP.

def test_handleNotifyLogging(self):

server.DNSServerFactory.handleNotify logs the message origin address if verbose > 0.

def test_handleOther(self):

server.DNSServerFactory.handleOther triggers the sending of a response message with rCode set to dns.ENOTIMP.

def test_handleOtherLogging(self):

server.DNSServerFactory.handleOther logs the message origin address if verbose > 0.

API Documentation for twisted, generated by pydoctor at 2020-03-25 17:34:30.