twisted.names.test.test_server.DNSServerFactoryTests(unittest.TestCase) class documentationtwisted.names.test.test_server
(View In Hierarchy)
Tests for server.DNSServerFactory.
| Method | test_resolverType | server.DNSServerFactory.resolveris aresolve.ResolverChaininstance | 
| Method | test_resolverDefaultEmpty | server.DNSServerFactory.resolveris an emptyresolve.ResolverChainby default. | 
| Method | test_authorities | server.DNSServerFactory.__init__accepts anauthoritiesargument. The value of this argument is
a list and is used to extend theresolverresolve.ResolverChain. | 
| Method | test_caches | server.DNSServerFactory.__init__accepts acachesargument. The value of this argument is a 
list and is used to extend theresolverresolve.ResolverChain. | 
| Method | test_clients | server.DNSServerFactory.__init__accepts aclientsargument. The value of this argument is a 
list and is used to extend theresolverresolve.ResolverChain. | 
| Method | test_resolverOrder | server.DNSServerFactory.resolvercontains an ordered list of authorities, caches and clients. | 
| Method | test_cacheDefault | server.DNSServerFactory.cacheisNoneby default. | 
| Method | test_cacheOverride | server.DNSServerFactory.__init__assigns the last object in thecacheslist toserver.DNSServerFactory.cache. | 
| Method | test_canRecurseDefault | server.DNSServerFactory.canRecurseis a flag indicating that this server is capable of performing recursive 
DNS lookups. It defaults toFalse. | 
| Method | test_canRecurseOverride | server.DNSServerFactory.__init__setscanRecursetoTrueif it is supplied withclients. | 
| Method | test_verboseDefault | server.DNSServerFactory.verbosedefaults toFalse. | 
| Method | test_verboseOverride | server.DNSServerFactory.__init__accepts averboseargument which overridesserver.DNSServerFactory.verbose. | 
| Method | test_interface | server.DNSServerFactoryimplementsIProtocolFactory. | 
| Method | test_defaultProtocol | server.DNSServerFactory.protocoldefaults todns.DNSProtocol. | 
| Method | test_buildProtocolProtocolOverride | server.DNSServerFactory.buildProtocolbuilds a protocol by callingserver.DNSServerFactory.protocolwith its self as a positional argument. | 
| Method | test_verboseLogQuiet | server.DNSServerFactory._verboseLogdoes not log messages unlessverbose > 0. | 
| Method | test_verboseLogVerbose | server.DNSServerFactory._verboseLoglogs a message ifverbose > 0. | 
| Method | test_messageReceivedLoggingNoQuery | server.DNSServerFactory.messageReceivedlogs about an empty query if the message had no queries andverboseis>0. | 
| Method | test_messageReceivedLogging1 | server.DNSServerFactory.messageReceivedlogs the query types of all queries in the message ifverboseis set to1. | 
| Method | test_messageReceivedLogging2 | server.DNSServerFactory.messageReceivedlogs the repr of all queries in the message ifverboseis set 
to2. | 
| Method | test_messageReceivedTimestamp | server.DNSServerFactory.messageReceivedassigns a unix timestamp to the received message. | 
| Method | test_messageReceivedAllowQuery | server.DNSServerFactory.messageReceivedpasses all messages toserver.DNSServerFactory.allowQueryalong with the receiving protocol and origin address. | 
| Method | test_allowQueryFalse | If allowQueryreturnsFalse,server.DNSServerFactory.messageReceivedcallsserver.sendReplywith a message whoserCodeisdns.EREFUSED. | 
| Method | test_queryMessageReceived | DNSServerFactory.messageReceivedpasses messages with an opcode ofOP_QUERYon toDNSServerFactory.handleQuery. | 
| Method | test_inverseQueryMessageReceived | DNSServerFactory.messageReceivedpasses messages with an opcode ofOP_INVERSEon toDNSServerFactory.handleInverseQuery. | 
| Method | test_statusMessageReceived | DNSServerFactory.messageReceivedpasses messages with an opcode ofOP_STATUSon toDNSServerFactory.handleStatus. | 
| Method | test_notifyMessageReceived | DNSServerFactory.messageReceivedpasses messages with an opcode ofOP_NOTIFYon toDNSServerFactory.handleNotify. | 
| Method | test_updateMessageReceived | DNSServerFactory.messageReceivedpasses messages with an opcode ofOP_UPDATEon toDNSServerFactory.handleOther. | 
| Method | test_connectionTracking | The connectionMadeandconnectionLostmethods 
ofDNSServerFactorycooperate to keep track of allDNSProtocolobjects created by a factory which are connected. | 
| Method | test_handleQuery | server.DNSServerFactory.handleQuerytakes the first query from the supplied message and dispatches it toserver.DNSServerFactory.resolver.query. | 
| Method | test_handleQueryCallback | No summary | 
| Method | test_handleQueryErrback | No summary | 
| Method | test_gotResolverResponse | server.DNSServerFactory.gotResolverResponseaccepts a tuple of resource record lists and triggers a response message 
containing those resource record lists. | 
| Method | test_gotResolverResponseCallsResponseFromMessage | server.DNSServerFactory.gotResolverResponsecallsserver.DNSServerFactory._responseFromMessageto generate a response. | 
| Method | test_responseFromMessageNewMessage | server.DNSServerFactory._responseFromMessagegenerates a response message which is a copy of the request message. | 
| Method | test_responseFromMessageRecursionAvailable | server.DNSServerFactory._responseFromMessagegenerates a response message whoserecAVattribute isTrueifserver.DNSServerFactory.canRecurseisTrue. | 
| Method | test_responseFromMessageTimeReceived | server.DNSServerFactory._responseFromMessagegenerates a response message whosetimeReceivedattribute has 
the same value as that found on the request. | 
| Method | test_responseFromMessageMaxSize | server.DNSServerFactory._responseFromMessagegenerates a response message whosemaxSizeattribute has the 
same value as that found on the request. | 
| Method | test_messageFactory | server.DNSServerFactoryhas a_messageFactoryattribute which isdns.Messageby 
default. | 
| Method | test_responseFromMessageCallsMessageFactory | No summary | 
| Method | test_responseFromMessageAuthoritativeMessage | server.DNSServerFactory._responseFromMessagemarks the response message as authoritative if any of the answer records 
are authoritative. | 
| Method | test_gotResolverResponseLogging | server.DNSServerFactory.gotResolverResponselogs the total number of records in the response ifverbose > 
0. | 
| Method | test_gotResolverResponseCaching | server.DNSServerFactory.gotResolverResponsecaches the response if at least one cache was provided in the 
constructor. | 
| Method | test_gotResolverErrorCallsResponseFromMessage | server.DNSServerFactory.gotResolverErrorcallsserver.DNSServerFactory._responseFromMessageto generate a response. | 
| Method | test_gotResolverErrorDomainError | server.DNSServerFactory.gotResolvertriggers a response 
message with anrCodeofdns.ENAMEif supplied 
with aerror.DomainError. | 
| Method | test_gotResolverErrorAuthoritativeDomainError | server.DNSServerFactory.gotResolvertriggers a response 
message with anrCodeofdns.ENAMEif supplied 
with aerror.AuthoritativeDomainError. | 
| Method | test_gotResolverErrorOtherError | server.DNSServerFactory.gotResolvertriggers a response 
message with anrCodeofdns.ESERVERif supplied 
with another type of error and logs the error. | 
| Method | test_gotResolverErrorLogging | server.DNSServerFactory.gotResolverlogs a message ifverbose > 0. | 
| Method | test_gotResolverErrorResetsResponseAttributes | server.DNSServerFactory.gotResolverErrordoes 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.sendReplyis supplied with a protocol *and* an address tuple it will supply that 
address toprotocol.writeMessage. | 
| Method | test_sendReplyWithoutAddress | If server.DNSServerFactory.sendReplyis supplied with a protocol but no address tuple it will supply only a 
message toprotocol.writeMessage. | 
| Method | test_sendReplyLoggingNoAnswers | If server.DNSServerFactory.sendReplylogs a "no answers" message if the supplied message has no 
answers. | 
| Method | test_sendReplyLoggingWithAnswers | If server.DNSServerFactory.sendReplylogs a message for answers, authority, additional if the supplied a message
has records in any of those sections. | 
| Method | test_handleInverseQuery | server.DNSServerFactory.handleInverseQuerytriggers the sending of a response message withrCodeset todns.ENOTIMP. | 
| Method | test_handleInverseQueryLogging | server.DNSServerFactory.handleInverseQuerylogs the message origin address ifverbose > 0. | 
| Method | test_handleStatus | server.DNSServerFactory.handleStatustriggers the sending of a response message withrCodeset todns.ENOTIMP. | 
| Method | test_handleStatusLogging | server.DNSServerFactory.handleStatuslogs the message origin address ifverbose > 0. | 
| Method | test_handleNotify | server.DNSServerFactory.handleNotifytriggers the sending of a response message withrCodeset todns.ENOTIMP. | 
| Method | test_handleNotifyLogging | server.DNSServerFactory.handleNotifylogs the message origin address ifverbose > 0. | 
| Method | test_handleOther | server.DNSServerFactory.handleOthertriggers the sending of a response message withrCodeset todns.ENOTIMP. | 
| Method | test_handleOtherLogging | server.DNSServerFactory.handleOtherlogs the message origin address ifverbose > 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.gotResolveraccepts afailure.Failureand triggers a response message whose rCode corresponds to the DNS error 
contained in theFailure. | 
Inherited from TestCase:
| Instance Variable | timeout | A real number of seconds. If set, the test will raise an error if it takes 
longer than timeoutseconds. If not set, 
util.DEFAULT_TIMEOUT_DURATION is used. | 
| Method | __init__ | Construct an asynchronous test case for methodName. | 
| Method | assertFailure | Fail if deferreddoes not errback with one ofexpectedFailures. 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,crashandstoponreactor. 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 _deprecateReactordid. | 
| Method | _runCleanups | Run the cleanups added with addCleanupin order. | 
| Method | _runFixturesAndTest | Really run setUp, the test method, andtearDown.  Any of these may returndefer.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 | Noneor 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 theTestResultsupports skipping). | 
| Instance Variable | todo | None,
a string or a tuple of(errors, reason)whereerrorsis either an exception class or an iterable of 
exception classes, andreasonis a string. SeeTodoormakeTodofor 
more information. | 
| Instance Variable | suppress | Noneor a list of tuples of(args, kwargs)to be passed towarnings.filterwarnings. Use these to suppress warnings raised
in a test. Useful for testing deprecated code. See alsoutil.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 methodNameargument is passed to the constructor,runwill 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 conditionevaluates to True. | 
| Method | assertTrue | Fail the test if conditionevaluates to False. | 
| Method | assertRaises | Fail the test unless calling the function fwith the givenargsandkwargsraisesexception. 
The failure will report the traceback and call stack of the unexpected 
exception. | 
| Method | assertEqual | Fail the test if firstandsecondare not 
equal. | 
| Method | assertIs | Fail the test if firstis notsecond.  This is
an obect-identity-equality test, not an object equality (i.e.__eq__) test. | 
| Method | assertIsNot | Fail the test if firstissecond.  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 containeeis not found incontainer. | 
| Method | assertNotIn | Fail the test if containeeis found incontainer. | 
| 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 substringdoes not exist withinastring. | 
| Method | assertNotSubstring | Fail if astringcontainssubstring. | 
| 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 instanceis not an instance of the given class or 
of one of the given classes. | 
| Method | assertNotIsInstance | Fail if instanceis an instance of the given class or of 
one of the given classes. | 
| Method | successResultOf | Return the current success result of deferredor raiseself.failureException. | 
| Method | failureResultOf | Return the current failure result of deferredor raiseself.failureException. | 
| Method | assertNoResult | Assert that deferreddoes not have a result at this 
point. | 
| Method | assertRegex | Fail the test if a regexpsearch oftextfails. | 
server.DNSServerFactory.resolver
is an empty resolve.ResolverChain
by default.
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.__init__
accepts a caches argument. The value of this argument is a 
list and is used to extend the resolver resolve.ResolverChain.
server.DNSServerFactory.__init__
accepts a clients argument. The value of this argument is a 
list and is used to extend the resolver resolve.ResolverChain.
server.DNSServerFactory.resolver
contains an ordered list of authorities, caches and clients.
server.DNSServerFactory.__init__
assigns the last object in the caches list to server.DNSServerFactory.cache.
server.DNSServerFactory.canRecurse
is a flag indicating that this server is capable of performing recursive 
DNS lookups. It defaults to False.
server.DNSServerFactory.__init__
sets canRecurse to True
if it is supplied with clients.
server.DNSServerFactory.__init__
accepts a verbose argument which overrides server.DNSServerFactory.verbose.
server.DNSServerFactory.buildProtocol
builds a protocol by calling server.DNSServerFactory.protocol
with its self as a positional argument.
server.DNSServerFactory._verboseLog
does not log messages unless verbose > 0.
server.DNSServerFactory._verboseLog
logs a message if verbose > 0.
server.DNSServerFactory.messageReceived
logs about an empty query if the message had no queries and 
verbose is >0.
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
assigns a unix timestamp to the received message.
server.DNSServerFactory.messageReceived
passes all messages to server.DNSServerFactory.allowQuery
along with the receiving protocol and origin address.
If allowQuery returns False, server.DNSServerFactory.messageReceived
calls server.sendReply with a message whose rCode
is dns.EREFUSED.
Assert that the named method is called with the given message when it is
passed to DNSServerFactory.messageReceived.
| Parameters | methodName | The name of the method which is expected to be called. (type: str) | 
| message | The message which is expected to be passed to the methodNamemethod. (type:dns.Message) | 
DNSServerFactory.messageReceived
passes messages with an opcode of OP_QUERY on to DNSServerFactory.handleQuery.
DNSServerFactory.messageReceived
passes messages with an opcode of OP_INVERSE on to DNSServerFactory.handleInverseQuery.
DNSServerFactory.messageReceived
passes messages with an opcode of OP_STATUS on to DNSServerFactory.handleStatus.
DNSServerFactory.messageReceived
passes messages with an opcode of OP_NOTIFY on to DNSServerFactory.handleNotify.
DNSServerFactory.messageReceived
passes messages with an opcode of OP_UPDATE on to DNSServerFactory.handleOther.
This may change if the implementation ever covers update messages.
The connectionMade and connectionLost methods 
of DNSServerFactory
cooperate to keep track of all DNSProtocol 
objects created by a factory which are connected.
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.gotResolverResponse
accepts a tuple of resource record lists and triggers a response message 
containing those resource record lists.
server.DNSServerFactory.gotResolverResponse
calls server.DNSServerFactory._responseFromMessage
to generate a response.
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.
server.DNSServerFactory._responseFromMessage
generates a response message whose maxSize attribute has the 
same value as that found on the request.
server.DNSServerFactory
has a _messageFactory attribute which is dns.Message by 
default.
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
marks the response message as authoritative if any of the answer records 
are authoritative.
server.DNSServerFactory.gotResolverResponse
logs the total number of records in the response if verbose > 
0.
server.DNSServerFactory.gotResolverResponse
caches the response if at least one cache was provided in the 
constructor.
server.DNSServerFactory.gotResolverError
calls server.DNSServerFactory._responseFromMessage
to generate a response.
server.DNSServerFactory.gotResolver accepts a failure.Failure
and triggers a response message whose rCode corresponds to the DNS error 
contained in the Failure.
| Parameters | responseError | The Exceptioninstance which is expected to triggerexpectedMessageCodewhen
it is supplied togotResolverError(type:Exception) | 
| expectedMessageCode | The rCodewhich is expected in the message returned bygotResolverErrorin response toresponseError. (type:int) | 
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.ENAME if supplied 
with a error.AuthoritativeDomainError.
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.gotResolver logs a message if 
verbose > 0.
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
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.
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.
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.
server.DNSServerFactory.handleInverseQuery
triggers the sending of a response message with rCode set to 
dns.ENOTIMP.
server.DNSServerFactory.handleInverseQuery
logs the message origin address if verbose > 0.
server.DNSServerFactory.handleStatus
triggers the sending of a response message with rCode set to 
dns.ENOTIMP.
server.DNSServerFactory.handleStatus
logs the message origin address if verbose > 0.
server.DNSServerFactory.handleNotify
triggers the sending of a response message with rCode set to 
dns.ENOTIMP.
server.DNSServerFactory.handleNotify
logs the message origin address if verbose > 0.
server.DNSServerFactory.handleOther
triggers the sending of a response message with rCode set to 
dns.ENOTIMP.
server.DNSServerFactory.handleOther
logs the message origin address if verbose > 0.