+
    Dfj\                        R t ^ RIt^ RIt^ RIt^ RIHtHt ^ RIHt ^ RI	H
t
 ^ RIHtHtHt ^ RIHt ^ RIHtHtHt ^ RIHtHtHtHtHt ^ R	IHt ^ R
IHtHtH t H!t!H"t"H#t# ^ RI$H%t% ^ RI&H't'H(t( ^ RI)H*t* ^ RI+H,t, ^ RI-H.t. R t/ ! R R]P`                  4      t1]PD                  ! RR^dRRR^^R7      t2]PD                  ! RR^xRRR^^R7      t3]PD                  ! RR^R^R ^dR!7      t4]1! R]23R]2]PB                  ! R"4      ]Pj                  ! R#4      ]Pl                  ! R$4      ]Pl                  ! R%R&4      ]Pn                  ! ^
R'4      ]Pp                  ! R(R)R*7      ]Pr                  ! R+4      ]Pt                  ! R,4      ]Pv                  ! R-4      ]Px                  ! R.R/4      ]Pz                  ! ^ R0R14      ]Pz                  ! ^R2R34      ]Pz                  ! ^R4R54      ]Px                  ! R64      ]P|                  ! R74      ]P~                  ! R8R9R:7      ]P                  ! ^R;R<7      ]P                  ! R=R>R?7      ]P                  ! R@]P                  RA4      ]P                  ! ^d^
RBRCRD4      ]P                  ! RE4      .RF]P                  ! RGRHRIRJ4      .RK]PB                  ! RL4      ]PB                  ! RM4      .RN]PB                  ! RO4      ]PB                  ! RP4      .RQ]Pr                  ! R4      .RR]PB                  ! RS4      ./RT7      tG]1! R]33RU]P                  ! RV4      ]3./RT7      tI]1! RW]43RW]4]PB                  ! RSRXRY7      ]Pj                  ! RZR[RY7      ]Pj                  ! R\R]RY7      ]P                  ! RGRHRIRJR^RY7      ./RT7      tJ ! R_ R`].P                  4      tL ! Ra Rb].P                  4      tM ! Rc Rd].P                  4      tN ! Re Rf].P                  4      tO ! Rg Rh].P                  4      tP ! Ri Rj].P                  4      tQ ! Rk Rl].P                  4      tR ! Rm Rn].P                  4      tS ! Ro Rp].P                  4      tTRqtU ! Rr Rs].P                  4      tVRttW ! Ru Rv].P                  4      tXR# )wz
Test cases for twisted.names.
N)partialreduce)BytesIO)pack)defererrorreactor)succeed)MemoryReactorClockStringTransportwaitUntilAllDisconnected)	authorityclientcommondnsserver)Resolver)SOAMessageQueryRecord_A
Record_SOARRHeader)DomainError)SecondaryAuthoritySecondaryAuthorityService)nativeString)FilePath)unittestc                 P    V ^ ,           Uu. uF  qP                   NK  	  up# u upi     payload)resultsrs   & ?/usr/lib/python3/dist-packages/twisted/names/test/test_names.pyjustPayloadr'   !   s     &qz*z!IIz***s   #c                   &   a  ] tR t^%t o R tRtV tR# )NoFileAuthorityc                `    \         P                  P                  V 4       WuV n        V n        R # N)r   ResolverBase__init__soarecords)selfr.   r/   s   &&&r&   r-   NoFileAuthority.__init__&   s$    $$T*!$$,    )r/   r.   N)__name__
__module____qualname____firstlineno__r-   __static_attributes____classdictcell____classdict__s   @r&   r)   r)   %   s     . .r2   r)      test-domain.comzroot.test-domain.com  i  H?&mnamernameserialrefreshminimumexpireretryttls   93.84.28.in-addr.arpai1  i~  Ϊ my-domain.coms   postmaster.test-domain.comi90  i?B )r?   r@   rA   rB   rC   rD   rE   s	   127.0.0.1s   39.28.189.39#   v=spf1 mx/30 mx:example.org/30 -all   v=spf1 +mx a: colo   .example.com/28 -all not validhost.test-domain.com   Linux   A Fast One, Dontcha know)oscpus   canonical.name.coms   mailbox.test-domain.coms   mail.group.someplace   A First piece of Text   a SecoNd pieces
   ABCD::4321r2   s	   0:0069::0s   some.network.tlds$   0:5634:1294:AFCB:56AC:48EF:34C3:01FFs   tra.la.la.net+   Some more text, haha!  Yes.     Still here?s   mail.redirect.or.whatevers
   r mail boxs
   e mail box)rmailbxemailbxs   afsdb.test-domain.com)subtypehostnames   whatever.i.dunnos   some.more.text)mboxtxts   12.54.78.12       u   sip+E2U!   !^.*$!sip:information@domain.tld!s'   AF43:5634:1294:AFCB:56AC:48EF:34C3:01FFs   http.tcp.test-domain.com  ?  骪  s   some.other.place.fool   host.test-domain.com   123.242.1.5   0.255.0.255s   host-two.test-domain.coms   255.255.255.254s   0.0.0.0s   cname.test-domain.coms   anothertest-domain.coms   1.2.3.4r.   r/   s   123.93.84.28.in-addr.arpas   test.host-reverse.lookup.coms   my-domain.com1SrF   s
   ns1.domains   2Ms
   ns2.domain3H4Dc                      a  ] tR t^t o RtR tR tR tR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR t R t!Rt"V t#R # )!ServerDNSTestsz'
Test cases for DNS server and client.
c                H   \         P                  ! \        \        \        .^R7      V n        \        P                  ! V P
                  4      p \        P                  ! ^ V P
                  RR7      pV P                  VP                  4       VP                  4       P                  p \        P                  ! W1RR7      pV P                  VP                  4        Y n        Y@n        \&        P(                  ! RT3.R7      T n        R#   \        P                    d     K  i ; i)   )verbose	127.0.0.1)	interfaceserversN)r   DNSServerFactorytest_domain_comreverse_domainmy_domain_comfactoryr   DNSDatagramProtocolr   	listenTCP
addCleanupstopListeninggetHostport	listenUDPr   CannotListenErrorlistenerTCPlistenerUDPr   r   resolver)r0   pr   r|   r   s   &    r&   setUpServerDNSTests.setUp   s    ..nm<a
 ##DLL1!++At||{SK OOK556&&(--D%//;O  9 9:&&+t1D0EF ** s   'D D! D!c                    V P                   P                  R,           F  pVP                  P                  4        K  	  \	        \
        V P                   P                  R,          4      # )z]
Clean up any server connections associated with the
L{DNSServerFactory} created in L{setUp}
NNN)rv   connections	transportloseConnectionr   r   )r0   conns   & r&   tearDownServerDNSTests.tearDown   sN     LL,,Q//DNN))+ 0 (1I1I!1LMMr2   c                :   a a VV 3R lpVP                  V4       V# )a  
Assert that the DNS response C{querying} will eventually fire with
contains exactly a certain collection of records.

@param querying: A L{Deferred} returned from one of the DNS client
    I{lookup} methods.

@param expectedRecords: A L{list} of L{IRecord} providers which must be
    in the response or the test will be failed.

@return: A L{Deferred} that fires when the assertion has been made.  It
    fires with a success result if the assertion succeeds and with a
    L{Failure} if it fails.
c                 f   < \        V 4      pSP                  \        S4      \        V4      4       R # r+   )r'   assertEqualset)responsereceivedRecordsexpectedRecordsr0   s   & r&   checkResults.ServerDNSTests.namesTest.<locals>.checkResults   s'    )(3OS133GHr2   )addCallback)r0   queryingr   r   s   f&f r&   	namesTestServerDNSTests.namesTest   s     	I 	\*r2   c                    V P                  V P                  P                  R4      \        P                  ! RRR7      .4      # )z"Test simple DNS 'A' record queriestest-domain.comrn   r=   rf   r   r   lookupAddressr   r   r0   s   &r&   test_addressRecord1"ServerDNSTests.test_addressRecord1   s7    ~~MM''(9:\\+845
 	
r2   c           	         V P                  V P                  P                  R4      \        P                  ! RRR7      \        P                  ! RRR7      .4      # )z1Test DNS 'A' record queries with multiple answersrL   z123.242.1.5r=   rf   z0.255.0.255r   r   s   &r&   test_addressRecord2"ServerDNSTests.test_addressRecord2   sG    ~~MM''(>?]9]9
 	
r2   c           	         V P                  V P                  P                  R4      \        P                  ! RRR7      \        P                  ! RRR7      .4      # )z+Test DNS 'A' record queries with edge caseszhost-two.test-domain.comz255.255.255.254r=   rf   0.0.0.0r   r   s   &r&   test_addressRecord3"ServerDNSTests.test_addressRecord3   sH    ~~MM''(BC.H=YH5
 	
r2   c                b    V P                  V P                  P                  R4      \        .4      # )zTest DNS 'SOA' record queriesr   )r   r   lookupAuthority
soa_recordr   s   &r&   test_authorityServerDNSTests.test_authority   s*    ~~MM))*;<zl
 	
r2   c           
         V P                  V P                  P                  R4      \        P                  ! ^
RRR7      \        P
                  ! RRR7      \        P
                  ! RRR7      .4      # )zs
The DNS client can issue an MX query and receive a response including
an MX record as well as any A record hints.
r;   ra   r=   rf   rb   rc   )r   r   lookupMailExchanger   	Record_MXr   r   s   &r&   test_mailExchangeRecord&ServerDNSTests.test_mailExchangeRecord   sZ    
 ~~MM,,-?@b"9xH^:^:
 	
r2   c                    V P                  V P                  P                  R4      \        P                  ! RRR7      .4      # )zTest DNS 'NS' record queriesr   z39.28.189.39r=   rf   )r   r   lookupNameserversr   	Record_NSr   s   &r&   test_nameserverServerDNSTests.test_nameserver  s7    ~~MM++,=>]]>x89
 	
r2   c           	         V P                  V P                  P                  R4      \        P                  ! RRRR7      .4      # )zTest DNS 'HINFO' record queriesr   rM   rN   r=   )rO   rP   rF   )r   r   lookupHostInfor   Record_HINFOr   s   &r&   
test_HINFOServerDNSTests.test_HINFO  sA    ~~MM(():;  %@h
 	
r2   c                    V P                  V P                  P                  R4      \        P                  ! RRR7      .4      # )zTest DNS 'PTR' record queriesz123.93.84.28.in-addr.arpaztest.host-reverse.lookup.comrG   rf   )r   r   lookupPointerr   
Record_PTRr   s   &r&   test_PTRServerDNSTests.test_PTR   s8    ~~MM''(CD^^:IJ
 	
r2   c                    V P                  V P                  P                  R4      \        P                  ! RRR7      .4      # )zTest DNS 'CNAME' record queriesr   zcanonical.name.comr=   rf   )r   r   lookupCanonicalNamer   Record_CNAMEr   s   &r&   
test_CNAMEServerDNSTests.test_CNAME'  s:    ~~MM--.?@2AB
 	
r2   c                    V P                  V P                  P                  R4      \        P                  ! RRR7      .4      # )zTest DNS 'MB' record queriesr   zmailbox.test-domain.comr=   rf   )r   r   lookupMailBoxr   	Record_MBr   s   &r&   test_MBServerDNSTests.test_MB.  s8    ~~MM''(9:]]4(CD
 	
r2   c                    V P                  V P                  P                  R4      \        P                  ! RRR7      .4      # )zTest DNS 'MG' record queriesr   zmail.group.someplacer=   rf   )r   r   lookupMailGroupr   	Record_MGr   s   &r&   test_MGServerDNSTests.test_MG5  s8    ~~MM))*;<]]1x@A
 	
r2   c                    V P                  V P                  P                  R4      \        P                  ! RRR7      .4      # )zTest DNS 'MR' record queriesr   zmail.redirect.or.whateverr=   rf   )r   r   lookupMailRenamer   	Record_MRr   s   &r&   test_MRServerDNSTests.test_MR<  s8    ~~MM**+<=]]6HEF
 	
r2   c           	         V P                  V P                  P                  R4      \        P                  ! RRRR7      .4      # )zTest DNS 'MINFO' record queriesr   z
r mail boxz
e mail boxr=   )rT   rU   rF   )r   r   lookupMailboxInfor   Record_MINFOr   s   &r&   
test_MINFOServerDNSTests.test_MINFOC  s@    ~~MM++,=>  (,H
 	
r2   c                    V P                  V P                  P                  R4      \        P                  ! RRRRRR7      .4      # )zTest DNS 'SRV' record querieszhttp.tcp.test-domain.comr^   r_   r`   some.other.place.foolr=   rf   )r   r   lookupServicer   
Record_SRVr   s   &r&   test_SRVServerDNSTests.test_SRVN  s>    ~~MM''(BC^^C/FHUV
 	
r2   c           	         V P                  V P                  P                  R4      \        P                  ! ^RRR7      .4      # )zTest DNS 'AFSDB' record queriesr   zafsdb.test-domain.comr=   )rV   rW   rF   )r   r   lookupAFSDatabaser   Record_AFSDBr   s   &r&   
test_AFSDBServerDNSTests.test_AFSDBU  sA    ~~MM++,=>  (?X
 	
r2   c           	         V P                  V P                  P                  R4      \        P                  ! RRRR7      .4      # )zTest DNS 'RP' record queriesr   zwhatever.i.dunnozsome.more.textr=   )rX   rY   rF   )r   r   lookupResponsibilityr   	Record_RPr   s   &r&   test_RPServerDNSTests.test_RP`  s?    ~~MM../@A+1Ax
 	
r2   c           	         V P                  V P                  P                  R4      \        P                  ! RRRR7      \        P                  ! RRR7      .4      # )zTest DNS 'TXT' record queriesr   rQ   rR   r=   rf   rS   )r   r   
lookupTextr   
Record_TXTr   s   &r&   test_TXTServerDNSTests.test_TXTk  sR    ~~MM$$%67,.?X C	

 
	
r2   c           
         V P                  V P                  P                  R4      \        P                  ! RRR7      \        P                  ! RRRR7      .4      # )z8
L{DNSServerFactory} can serve I{SPF} resource records.
r   rI   r=   rf   rJ   rK   )r   r   lookupSenderPolicyr   
Record_SPFr   s   &r&   test_spfServerDNSTests.test_spfy  sQ     ~~MM,,->?E8T*5 

 
	
r2   c           
         V P                  V P                  P                  R4      \        P                  ! R\
        P                  RRR7      .4      # )zTest DNS 'WKS' record queriesr   z12.54.78.12rZ   r=   rf   )r   r   lookupWellKnownServicesr   
Record_WKSsocketIPPROTO_TCPr   s   &r&   test_WKSServerDNSTests.test_WKS  sI    ~~MM112CD!&&3 	

 
	
r2   c                v   \         P                   ! \        4      p\        P                  Vn        V P	                  V P
                  P                  R 4      V\        P                  ! RRR7      \        P                  ! RRR7      \        P                  ! RRR7      \        P                  ! RR	R
RRR7      .4      # )rH   1.2.3.4re   rf   z
ns1.domain2Mz
ns2.domainrg   r^   r_   r`   r   rh   )copymy_soarD   rF   r   r   lookupAllRecordsr   r   r   r   )r0   
result_soas   & r&   test_someRecordsWithTTLs'ServerDNSTests.test_someRecordsWithTTLs  s    YYv&

~~MM**?;YD1l5l5sE52ItT	
 		
r2   c                    V P                  V P                  P                  R4      \        P                  ! RRR7      .4      # )z%Test DNS 'AAAA' record queries (IPv6)r   z'AF43:5634:1294:AFCB:56AC:48EF:34C3:01FFr=   rf   )r   r   lookupIPV6Addressr   Record_AAAAr   s   &r&   	test_AAAAServerDNSTests.test_AAAA  s8    ~~MM++,=>__FHUV
 	
r2   c                    V P                  V P                  P                  R4      \        P                  ! ^ RRRR7      \        P                  ! ^RRRR7      \        P                  ! ^RR	RR7      .4      # )
z#Test DNS 'A6' record queries (IPv6)r   z
ABCD::4321 r=   rf   z	0:0069::0zsome.network.tldz$0:5634:1294:AFCB:56AC:48EF:34C3:01FFztra.la.la.net)r   r   lookupAddress6r   	Record_A6r   s   &r&   test_A6ServerDNSTests.test_A6  sh    ~~MM(():;arx@b+/AxP:# 		
 	
r2   c                   \         P                  p\        \        P                  \
        P                  P                  4       4       Uu. uF  p\        P                  ! V4      NK  	  ppV F  pVP                  e   K  Wn	        K  	  V P                  V P                  P                  R4      P                  R 4      V4      # u upi )z)
Test DNS 'AXFR' queries (Zone transfer)
r   c                     V ^ ,          RR 3# )r!   N )r%   s   &r&   <lambda>2ServerDNSTests.test_zoneTransfer.<locals>.<lambda>  s    1Q49,r2   )r   rD   r   operatoraddrs   r/   valuesr   rF   r   r   
lookupZoner   )r0   default_ttlr%   r$   s   &   r&   test_zoneTransfer ServerDNSTests.test_zoneTransfer  s     !''"(7N7N7U7U7W"X
"XQDIIaL"X 	 
 Auu}#  ~~MM$$%67CC& 	
 	

s   	Cc                z    \        R.R7      pV P                  VP                  R4      \        P                  4      # )z]
A failed AXFR TCP connection errbacks the L{Deferred} returned
from L{Resolver.lookupZone}.
rp   zimpossible.invalid)znameserver.invalid5   )r   assertFailurer  r   DNSLookupError)r0   r   s   & r&    test_zoneTransferConnectionFails/ServerDNSTests.test_zoneTransferConnectionFails  s<    
 %?$@A!! 45u7K7K
 	
r2   c                    V P                  V P                  P                  R4      \        P                  ! RRR7      .4      # )z6Tests that unrelated zones don't mess with each other.zanothertest-domain.comr   r=   rf   r   r   s   &r&   test_similarZonesDontInterfere-ServerDNSTests.test_similarZonesDontInterfere  s7    ~~MM''(@A\\)23
 	
r2   c                    V P                  V P                  P                  R4      \        P                  ! ^d^
RRRRR7      .4      # )z"
Test DNS 'NAPTR' record queries.
r   r[   r\   r]   r=   rf   )r   r   lookupNamingAuthorityPointerr   Record_NAPTRr   s   &r&   
test_NAPTRServerDNSTests.test_NAPTR  sM     ~~MM667HI  8 	
 	
r2   )rv   r   r   r   N)$r3   r4   r5   r6   __doc__r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r   r#  r(  r7   r8   r9   s   @r&   rj   rj      s     G<N.





	





	

	
	


 



 
$


 
r2   rj   c                   &   a  ] tR tRt o R tRtV tR# )HelperTestsi  c                    V P                  4       p\        P                  ! V4      p\        ^4       F.  p\        P                  ! V4      pV P	                  W$8  4       TpK0  	  R# )   N)mktempr   	getSerialrange
assertTrue)r0   faibs   &    r&   test_serialGenerator HelperTests.test_serialGenerator  sN    KKM"rA##A&AOOAE"A r2   r  N)r3   r4   r5   r6   r7  r7   r8   r9   s   @r&   r,  r,    s      r2   r,  c                   >   a  ] tR tRt o R tR tR tR tR tRt	V t
R# )		AXFRTestsi  c                   R V n         \        P                  ! 4       V n        V P                  P	                  V P
                  4       \        P                  ! RV P                  4      V n        \        P                  ! R\        P                  \        P                  RR\        P                  ! RR^d^RRRRR	7      R
7      V n        V P                  \        P                  ! R\        P                  \        P                  RR\        P                   ! RRR7      R
7      \        P                  ! R\        P"                  \        P                  RR\        P$                  ! ^
RRR7      R
7      \        P                  ! R\        P&                  \        P                  RR\        P(                  ! RRR7      R
7      V P                  .V n        R # )N	fooby.comiQ Fzhooj.fooby.comi,  i  i  iX  )r?   r@   rA   rB   rE   rD   rC   rF   nametypeclsrF   authr#     ns.twistedmatrix.comr>  rF   zmail.mv3d.com)
preferenceexchangerF   z64.123.27.105)addressrF   )r$   r   Deferreddr   _gotResultsr   AXFRController
controllerr   r   r   INr   r.   NSr   MXr   Ar   r/   r   s   &r&   r   AXFRTests.setUp  sH   !4++, //TVVD<<NN!&	
& HHLL VVFF+AsK LL VVFFoSVW LL UUFF_#F HH5
r2   c                @    \         P                  ! R ^^ ^ ^^^ ^ ^ R7	      # )  	idansweropCoderecDesrecAvrA  rCodetruncmaxSize)r   r   r   s   &r&   _makeMessageAXFRTests._makeMessage2  s.    {{

 
	
r2   c                @   V P                  4       p\        P                  ! R \        P                  \        P                  4      .Vn        V P                  Vn        V P                  P                  VR4       V P                  V P                  V P                  4       R# )r<  N)r]  r   r   AXFRrM  queriesr/   answersrL  messageReceivedr   r$   )r0   ms   & r&   test_bindAndTNamesStyle!AXFRTests.test_bindAndTNamesStyle@  sf    YY{CHHcff=>	LL	''40t||4r2   c                    Wn         R # r+   )r$   )r0   results   &&r&   rJ  AXFRTests._gotResultsH  s    r2   c                    V P                   R ,          pV'       dM   V P                  4       p. Vn        VP                  ^ 4      .Vn        V P
                  P                  VR4       KT  V P                  V P                  V P                   4       R# )r   N)	r/   r]  ra  poprb  rL  rc  r   r$   )r0   r/   rd  s   &  r&   test_DJBStyleAXFRTests.test_DJBStyleK  se    ,,q/!!#AAI Q(AIOO++At4t||4r2   )rL  rI  r/   r$   r.   N)r3   r4   r5   r6   r   r]  re  rJ  rl  r7   r8   r9   s   @r&   r:  r:    s$     3
j
55 5r2   r:  c                   ,   a  ] tR tRt o R tR tRtV tR# )ResolvConfHandlingTestsiV  c                    V P                  4       p\        P                  ! VR 7      pV P                  VP                  R.4       VP
                  P                  4        R# )resolvNrn   r  )r/  r   r   r   
dynServers
_parseCallcancelr0   
resolvConfr%   s   &  r&   test_missing$ResolvConfHandlingTests.test_missingW  sC    [[]
OO:.(9':;	r2   c                    V P                  4       p\        VR 4      P                  4        \        P                  ! VR7      pV P                  VP                  R.4       VP                  P                  4        R# )wrq  Nrs  )	r/  opencloser   r   r   rt  ru  rv  rw  s   &  r&   
test_empty"ResolvConfHandlingTests.test_empty]  sV    [[]
Z##%OO:.(9':;	r2   r  N)r3   r4   r5   r6   ry  r  r7   r8   r9   s   @r&   ro  ro  V  s      r2   ro  c                   N   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
tV tR# )AuthorityTestsie  zg
Tests for the basic response record selection code in L{FileAuthority}
(independent of its fileness).
c                    \         pRVP                  ^ ,          ,           pV P                  VP                  V4      4      pV P	                  VP
                  \        4       R# )a  
L{FileAuthority} lookup methods errback with L{DomainError} if
the requested C{name} shares a common suffix with its zone but
is not actually a descendant of its zone, in terms of its
sequence of DNS name labels. eg www.the-example.com has
nothing to do with the zone example.com.
   nonexistent.prefix-N)rs   r.   failureResultOfr   assertIsInstancevaluer   )r0   
testDomaintestDomainNamer3  s   &   r&   'test_domainErrorForNameWithCommonSuffix6AuthorityTests.test_domainErrorForNameWithCommonSuffixk  sK     %
/*..2CC  !9!9.!IJagg{3r2   c                L   \        \        P                  P                  \        3\        P                  P                  \        \        P
                  ! R4      ./R7      pV P                  VP                  ! \        P                  P                  4      4      w  r!pV P                  V. 4       V P                  V\        P                  ! \        P                  P                  \        P                  \        P                  \        RR7      .4       V P                  V. 4       R# )z
If a L{FileAuthority} has a zone which includes an I{NS} record for a
particular name and that authority is asked for another record for the
same name which does not exist, the I{NS} record is not included in the
authority section of the response.
r   rd   TrF   r#   rA  N)r)   r   r?   r>  r   r   successResultOfr   r   r   TYPErD   )r0   r   rV  
additionals   &   r&   test_recordMissing!AuthorityTests.test_recordMissingx  s     $!!&&
3  %%MM),(
	 )-(<(<##J$4$4$9$9:)
%: 	$$$))OO"))&	
 	R(r2   c           	        \         pRVP                  ^ ,          ,           p\        \        P                  4      ^,           pV P                  VP                  \        W#R7      4      4      pV P                  VP                  \        4       R# )zp
Requesting a record of unknown type where no records exist for the name
in question results in L{DomainError}.
r  r>  r?  N)rs   r.   maxr   typeToMethodr  queryr   r  r  r   )r0   r  r  unknownTyper3  s   &    r&   test_unknownTypeNXDOMAIN'AuthorityTests.test_unknownTypeNXDOMAIN  sj    
 %
/*..2CC&--.2  UIJ
 	agg{3r2   c           	         \        \        P                  4      ^,           pV P                  \        P                  \        RVR7      4      4      w  r#pV P                  V. 4       R# )zx
Requesting a record of unknown type where other records exist for the
name in question results in an empty answer set.
rH   r  N)r  r   r  r  ru   r  r   r   )r0   r  rV  r   r  s   &    r&   test_unknownTypeMissing&AuthorityTests.test_unknownTypeMissing  sU    
 &--.2(,(<(<? MN)
%: 	$r2   c                   R\         P                  P                  ,           p\        P                  ! R4      p\        \         P                  P                  \         3VV./R7      p\        WA4      ! V4      pV P                  V4      w  rdpV P                  V. 4       V P                  V\        P                  ! V\        P                  \         P                  VRR7      .4       V P                  V. 4       R# )z
Create an authority and make a request against it.  Then verify that the
result is a referral, including no records in the answers or additional
sections, but with an I{NS} record in the authority section.
s   example.r   rd   Fr  N)r   r?   r>  r   r   r)   getattrr  r   r   rN  rD   )r0   method	subdomain
nameserverr   rI  rV  r  s   &&      r&   _referralTestAuthorityTests._referralTest  s      *"2"2"7"77	]]9-
#!!&&
3
	 I&y1(,(<(<Q(?%:$FF"))&	
 	R(r2   c                (    V P                  R4       R# )z
When an I{NS} record is found for a child zone, it is included in the
authority section of the response. It is marked as non-authoritative if
the authority is not also authoritative for the child zone (RFC 2181,
section 6.1).
r   Nr  r   s   &r&   test_referralAuthorityTests.test_referral  s     	?+r2   c                (    V P                  R4       R# )zD
A referral is also generated for a request of type C{ALL_RECORDS}.
r   Nr  r   s   &r&   test_allRecordsReferral&AuthorityTests.test_allRecordsReferral  s     	-.r2   r  N)r3   r4   r5   r6   r*  r  r  r  r  r  r  r  r7   r8   r9   s   @r&   r  r  e  s4     
4 )D4	%)B,/ /r2   r  c                      a  ] tR tRt o Rt]P                  ! R4      t]P                  ! R4      t	R t
R tR tR tR	 tR
 tR tR tR tR tR tR tR tR tR tRtV tR# )AdditionalProcessingTestsi  zn
Tests for L{FileAuthority}'s additional processing for those record types
which require it (MX, CNAME, etc).
s   10.0.0.1s   f080::1c                    \        VP                  P                  V3VP                  P                  V! V4      .WE/R7      p\        Wa4      ! \        P                  P                  4      # )a\  
Perform a DNS lookup against a L{FileAuthority} configured with records
as defined by C{makeRecord} and C{addresses}.

@param method: The name of the lookup method to use; for example,
    C{"lookupNameservers"}.
@type method: L{str}

@param soa: A L{Record_SOA} for the zone for which the L{FileAuthority}
    is authoritative.

@param makeRecord: A one-argument callable which accepts a name and
    returns an L{IRecord} provider.  L{FileAuthority} is constructed
    with this record.  The L{FileAuthority} is queried for a record of
    the resulting type with the given name.

@param target: The extra name which the record returned by
    C{makeRecord} will be pointed at; this is the name which might
    require extra processing by the server so that all the available,
    useful information is returned.  For example, this is the target of
    a CNAME record or the mail exchange host pointed to by an MX record.
@type target: L{bytes}

@param addresses: A L{list} of records giving addresses of C{target}.

@return: A L{Deferred} that fires with the result of the resolver
    method give by C{method}.
rd   )r)   r?   r>  r  r   )r0   r  r.   
makeRecordtarget	addressesr   s   &&&&&& r&   _lookupSomeRecords,AdditionalProcessingTests._lookupSomeRecords  sY    : $%		F!3 4
	 y)**:*:*?*?@@r2   c                X    R pV P                  \        WR7      \        W#R7      4       R# )a  
Assert that the L{RRHeader} instances given by C{expected} and
C{computed} carry all the same information but without requiring the
records appear in the same order.

@param expected: A L{list} of L{RRHeader} instances giving the expected
    records.

@param computed: A L{list} of L{RRHeader} instances giving the records
    computed by the scenario under test.

@raise self.failureException: If the two collections of records
    disagree.
c                     V P                   # r+   )r?  )rrs   &r&   r  >AdditionalProcessingTests.assertRecordsMatch.<locals>.<lambda>$  s    r2   )keyN)r   sorted)r0   expectedcomputedr  s   &&& r&   assertRecordsMatch,AdditionalProcessingTests.assertRecordsMatch  s#    $ !2F84MNr2   c                P   R\         P                  P                  ,           pV P                  V\         W$V4      pV P	                  V4      w  rgpT P                  V U	u. uF6  p	\        P                  ! VV	P                  \         P                  V	RR7      NK8  	  up	V4       R# u up	i )a  
Verify that certain address records are included in the I{additional}
section of a response generated by L{FileAuthority}.

@param method: See L{_lookupSomeRecords}

@param makeRecord: See L{_lookupSomeRecords}

@param addresses: A L{list} of L{IRecord} providers which the
    I{additional} section of the response is required to match
    (ignoring order).

@raise self.failureException: If the I{additional} section of the
    response consists of different records than those given by
    C{addresses}.
s   mail.Tr  N)
r   r?   r>  r  r  r  r   r   r  rD   )
r0   r  r  r  r  rI  rV  r   r  rG  s
   &&&&      r&   _additionalTest)AdditionalProcessingTests._additionalTest'  s    " J,,111##FJ
IV(,(<(<Q(?%:  )	  )G LL"))#  )	 	
	s   <B#c                \    V P                  R\        \        P                  ^
4      V4       R# )z
Verify that a response to an MX query has certain records in the
I{additional} section.

@param addresses: See C{_additionalTest}
r   N)r  r   r   r   r0   r  s   &&r&   _additionalMXTest+AdditionalProcessingTests._additionalMXTestJ  s$     	 '#--"<i	
r2   c                >    V P                  V P                  .4       R# )zl
If the name of the MX response has A records, they are included in the
additional section of the response.
N)r  _Ar   s   &r&   test_mailExchangeAdditionalA6AdditionalProcessingTests.test_mailExchangeAdditionalAU      
 	y)r2   c                >    V P                  V P                  .4       R# )zo
If the name of the MX response has AAAA records, they are included in
the additional section of the response.
N)r  _AAAAr   s   &r&   test_mailExchangeAdditionalAAAA9AdditionalProcessingTests.test_mailExchangeAdditionalAAAA\      
 	

|,r2   c                T    V P                  V P                  V P                  .4       R# )z~
If the name of the MX response has both A and AAAA records, they are
all included in the additional section of the response.
N)r  r  r  r   s   &r&   test_mailExchangeAdditionalBoth9AdditionalProcessingTests.test_mailExchangeAdditionalBothc      
 	45r2   c                H    V P                  R\        P                  V4       R# )z
Verify that a response to an NS query has certain records in the
I{additional} section.

@param addresses: See C{_additionalTest}
r   N)r  r   r   r  s   &&r&   _additionalNSTest+AdditionalProcessingTests._additionalNSTestj  s     	0#--Kr2   c                >    V P                  V P                  .4       R# )zl
If the name of the NS response has A records, they are included in the
additional section of the response.
N)r  r  r   s   &r&   test_nameserverAdditionalA4AdditionalProcessingTests.test_nameserverAdditionalAs  r  r2   c                >    V P                  V P                  .4       R# )zo
If the name of the NS response has AAAA records, they are included in
the additional section of the response.
N)r  r  r   s   &r&   test_nameserverAdditionalAAAA7AdditionalProcessingTests.test_nameserverAdditionalAAAAz  r  r2   c                T    V P                  V P                  V P                  .4       R# )z~
If the name of the NS response has both A and AAAA records, they are
all included in the additional section of the response.
N)r  r  r  r   s   &r&   test_nameserverAdditionalBoth7AdditionalProcessingTests.test_nameserverAdditionalBoth  r  r2   c                B   R\         P                  P                  ,           pV P                  R\         \        P
                  W!4      pV P                  V4      w  rEp\        P                  ! \         P                  P                  \        P                  \         P                  \        P
                  ! V4      RR7      pT P                  V Uu. uF6  p\        P                  ! VVP                  \         P                  VRR7      NK8  	  upV.,           V4       R# u upi )z
Verify that a response to a CNAME query has certain records in the
I{answer} section.

@param addresses: See C{_additionalTest}
s   www.r   Tr  N)r   r?   r>  r  r   r   r  r   CNAMErD   r  r  )	r0   r  r  rI  rV  r   r  aliasrG  s	   &&       r&   _answerCNAMETest*AdditionalProcessingTests._answerCNAMETest  s     :++000##!:s/?/?
 )-(<(<Q(?%:!!II!!$$V,
 	  )	  )G LL"))#  )	 g
 	
	s   <Dc                >    V P                  V P                  .4       R# )zk
If the name of the CNAME response has A records, they are included in
the answer section of the response.
N)r  r  r   s   &r&   test_canonicalNameAnswerA3AdditionalProcessingTests.test_canonicalNameAnswerA  s    
 	twwi(r2   c                >    V P                  V P                  .4       R# )zn
If the name of the CNAME response has AAAA records, they are included
in the answer section of the response.
N)r  r  r   s   &r&   test_canonicalNameAnswerAAAA6AdditionalProcessingTests.test_canonicalNameAnswerAAAA  s    
 	tzzl+r2   c                T    V P                  V P                  V P                  .4       R# )z}
If the name of the CNAME response has both A and AAAA records, they are
all included in the answer section of the response.
N)r  r  r  r   s   &r&   test_canonicalNameAnswerBoth6AdditionalProcessingTests.test_canonicalNameAnswerBoth  s    
 	tww

34r2   r  N)r3   r4   r5   r6   r*  r   r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r7   r8   r9   s   @r&   r  r    s~     
 
k	"BOOJ'E$ALO*!
F	
*-6L*-6!
F),5 5r2   r  c                   &   a  ] tR tRt o R tRtV tR# )NoInitialResponseTestsi  c                  a V3R lpR p\        R.R7      pWn        . oV P                  \        P                  RV4       \        P
                  ! R\        P                  \        P                  RR\        P                  ! RRR	7      R
7      .p\        P                  ! R^^ ^ ^^^ ^ ^ R7	      pWEn
        SP                  V4       V P                  VP                  R4      \        P                  4      # )z
If a request returns a L{dns.NS} response, but we can't connect to the
given server, the request fails with the error returned at connection.
c                 8   < \        SP                  ^ 4      4      # r    )r	   rk  )r0   argsmessagess   &*r&   r  3NoInitialResponseTests.test_noAnswer.<locals>.query  s     8<<?++r2   c                 V    \         P                  ! \        P                  ! R 4      4      # )zCouldn't connect)r   failr   gaierror)r0   r  kwargss   &*,r&   queryProtocol;NoInitialResponseTests.test_noAnswer.<locals>.queryProtocol  s    ::foo.@ABBr2   rp   r  z	fooba.comrB  FrC  rD  r=  rS  rT  r<  )r   r!   )r   _querypatchr   rw   r   rN  rM  r   r   rb  appendr  getHostByNamer   r  )r0   r  r  r   r/   rd  r  s   &     @r&   test_noAnswer$NoInitialResponseTests.test_noAnswer  s    	,
	C ^$45 	

3**G]C LL VVFF+AsK	
 KK

 	!!("8"8"EvWWr2   r  N)r3   r4   r5   r6   r  r7   r8   r9   s   @r&   r  r    s     ,X ,Xr2   r  c                   6   a  ] tR tRt o RtR tR tR tRtV t	R# )SecondaryAuthorityServiceTestsi  z
Tests for L{SecondaryAuthorityService}, a service which keeps one or more
authorities up to date by doing zone transfers from a master.
c                   Rp\        VRR.4      pV P                  VP                  V4       V P                  VP                  ^54       V P                  VP                  ^ ,          P                  V4       V P                  VP                  ^ ,          P                  ^54       V P                  VP                  ^ ,          P
                  R4       V P                  VP                  ^,          P                  V4       V P                  VP                  ^,          P                  ^54       V P                  VP                  ^,          P
                  R4       R# )z
L{SecondaryAuthorityService} can be constructed with a C{str} giving a
master server address and several domains, causing the creation of a
secondary authority for each domain and that master server address and
the default DNS port.
192.168.1.2   example.comzexample.orgs   example.orgN)r   r   primary_portdomainsdomainr0   r  services   &  r&   test_constructAuthorityFromHost>SecondaryAuthorityServiceTests.test_constructAuthorityFromHost  s      +Gnm5TU'2++33W=+1126+22NC+33W=+1126+22NCr2   c                   RpRp\         P                  ! W3RR.4      pV P                  VP                  V4       V P                  VP                  R4       V P                  VP
                  ^ ,          P                  V4       V P                  VP
                  ^ ,          P                  V4       V P                  VP
                  ^ ,          P                  R4       V P                  VP
                  ^,          P                  V4       V P                  VP
                  ^,          P                  V4       V P                  VP
                  ^,          P                  R4       R# )a,  
L{SecondaryAuthorityService.fromServerAddressAndDomains} constructs a
new L{SecondaryAuthorityService} from a C{str} giving a master server
address and DNS port and several domains, causing the creation of a secondary
authority for each domain and that master server address and the given
DNS port.
192.168.1.3i  zexample.net   example.edu   example.netN)r   fromServerAddressAndDomainsr   r  r  r  r  )r0   r  r|   r
  s   &   r&   &test_constructAuthorityFromHostAndPortESecondaryAuthorityServiceTests.test_constructAuthorityFromHostAndPort  s     +GGOm^<
 	'2-+33W=+1148+22NC+33W=+1148+22NCr2   c                   Rp\        VP                  4       RR.4      pV P                  VP                  V4       V P                  VP                  ^ ,          P                  V4       V P                  VP                  ^ ,          P
                  R4       V P                  VP                  ^,          P                  V4       V P                  VP                  ^,          P
                  R4       R# )a!  
L{SecondaryAuthorityService.fromServerAddressAndDomains} constructs a
new L{SecondaryAuthorityService} from a C{bytes} giving a master server
address and several domains, causing the creation of a secondary
authority for each domain and that master server address and the given
DNS port.
r  r  zexample.edur  N)r   encoder   r  r  r  r	  s   &  r&    test_constructAuthorityFromBytes?SecondaryAuthorityServiceTests.test_constructAuthorityFromBytes#  s      +NN]+
 	'2+33W=+22NC+33W=+22NCr2   r  N)
r3   r4   r5   r6   r*  r  r  r  r7   r8   r9   s   @r&   r  r    s"     
D(D0D Dr2   r  c                   <   a  ] tR tRt o RtR tR tR tR tRt	V t
R# )	SecondaryAuthorityTestsi9  z
L{twisted.names.secondary.SecondaryAuthority} correctly constructs objects
with a specified IP address and optionally specified DNS port.
c                    \        RR4      pV P                  VP                  R4       V P                  VP                  ^54       V P                  VP                  R4       R# )zX
When constructed using L{SecondaryAuthority.__init__}, the default port
of 53 is used.
192.168.1.1
inside.com
   inside.comN)r   r   r  r  r  r0   	secondarys   & r&   test_defaultPort(SecondaryAuthorityTests.test_defaultPort?  sP    
 '}lC	**M:"-))=9r2   c                    \         P                  ! RR4      pV P                  VP                  R4       V P                  VP                  R4       V P                  VP
                  R4       R# )zf
When constructed using L{SecondaryAuthority.fromServerAddressAndDomain},
the specified port is used.
r    r  r  N)r  r#  )r   fromServerAddressAndDomainr   r  r  r  r  s   & r&   test_explicitPort)SecondaryAuthorityTests.test_explicitPortI  s[    
 'AA!<
	 	**M:$/))=9r2   c                f   \         P                  ! RR4      p\        4       ;Vn        pVP	                  4        VP
                  P                  ^ 4      w  r4rVpV P                  VR4       V P                  VR4       VP                  W434      p\        4       p	VP                  V	4       \        4       p
V
P                  \        V	P                  4       R,          4      4       V P                  \        P                   ! R\        P"                  \        P$                  4      .V
P&                  4       R# )z
An attempt is made to transfer the zone for the domain the
L{SecondaryAuthority} was constructed with from the server address it
was constructed with when L{SecondaryAuthority.transfer} is called.
r  r<   example.comrl   NNNr  r<   )r   r$  r
   _reactortransfer
tcpClientsrk  r   buildProtocolr   makeConnectionr   decoder   r  r   r   r`  rM  ra  )r0   r  r   hostr|   rv   timeoutbindAddressprotor   msgs   &          r&   test_transfer%SecondaryAuthorityTests.test_transferU  s     'AA!=
	 (:';;	W 5<4F4F4J4J14M1Gk}-t$ %%tl3#%	Y'i 	

79??,R012#))M388SVVDEs{{Sr2   c                   \         P                  ! RR4      p\        4       ;Vn        pVP	                  4        VP
                  P                  ^ 4      w  r4rVpVP                  W434      p\        4       p	VP                  V	4       \        ^^R7      p
V
P                  \        V	P                  4       R,          4      4       \        RRRRRR	R
RR7      p\        R^ R7      p\        V
P                   ^^R7      pVP"                  P%                  \'        R\(        VR7      \'        RVR7      \'        R\(        VR7      .4       VP+                  4       pVP-                  \/        R\1        V4      4      V,           4       V P3                  VP5                  R4      4      pV P7                  \'        RVRR7      .. . 3V4       R# )z
L{SecondaryAuthority.lookupAddress} returns a L{Deferred} that fires
with the I{A} records the authority has cached from the primary.
r  )rV  rA  r)  s   ns1.example.comzadmin.example.comi@ i  i  i   i%  i.  r>   s   192.168.1.2rf   )rU  rV  rA  )r?  r#   r"   z!Hr(  T)r#   rA  Nr*  )r   r$  r
   r+  r,  r-  rk  r.  r   r/  r   r0  r   r  r   r   rU  rb  extendr   r   toStrdataReceivedr   lenr  r   r   )r0   r  r   r1  r|   rv   r2  r3  r4  r   r  r.   r4  rV  datarh  s   &               r&   test_lookupAddress*SecondaryAuthorityTests.test_lookupAddresss  s   
 'AA!>
	 (:';;	W4;4F4F4J4J14M1Gk%%tl3#%	Y'qq)WY__.r234 $%	
 ^+EHHQQ7c3?3c3?	
 ||~4c$i0478%%i&=&=m&LM~qt<=r2F	
r2   r  N)r3   r4   r5   r6   r*  r   r%  r6  r>  r7   r8   r9   s   @r&   r  r  9  s$     
:
:T<0
 0
r2   r  sY  $ORIGIN example.com.
$TTL    1w
example.com. IN SOA dns.example.com (
            2013120201 ; serial number of this zone file
            1d         ; slave refresh
            2h         ; slave retry time in case of a problem
            4w         ; slave expiration time
            1h         ; maximum caching time in case of failed lookups
            )

; A comment.
@                  IN AAAA 2001:db8:10::1
example.com.       IN A 10.0.0.1
no-in.example.com. A 10.0.0.2  ; technically wrong but used to work
not-fqdn           IN MX 10 mx.example.com
www                IN CNAME example.comc                   `   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
 tR tR tRtV tR# )BindAuthorityTestsi  z5
Tests for L{twisted.names.authority.BindAuthority}.
c                    \        V P                  4       P                  R4      4      pVP                  V4       \        P
                  ! VP                  4      # )z
Create a new L{twisted.names.authority.BindAuthority} from C{s}.

@param s: A string with BIND zone data.
@type s: bytes

@return: a new bind authority
@rtype: L{twisted.names.authority.BindAuthority}
ascii)r   r/  r  
setContentr   BindAuthoritypath)r0   sfps   && r&   loadBindString!BindAuthorityTests.loadBindString  s@     dkkm**734
a&&rww//r2   c                :    V P                  \        4      V n        R # r+   )rI  sampleBindZonerA  r   s   &r&   r   BindAuthorityTests.setUp  s    ''7	r2   c                    V P                   P                  P                  4        FE  pV P                   P                  V,           F!  pV P                  RVP                  8H  4       K#  	  KG  	  R# )z7
Loads the default $TTL and applies it to all records.
:	 N)rA  r/   keysr2  rF   )r0   domrecs   &  r&   test_ttlBindAuthorityTests.test_ttl  sR     99$$))+Cyy((--#'' 12 . ,r2   c                    V P                  RV P                  P                  4       V P                  RV P                  P                  4       R# )z
Loads the default $ORIGIN.
s   example.com.   not-fqdn.example.comN)r   rA  originassertInr/   r   s   &r&   test_originFromFile&BindAuthorityTests.test_originFromFile  s@     	II	
 	#II	
r2   c                    R Fh  w  rV P                  V P                  P                  V4      4      w  w  pw   w   V P                  \        P
                  ! VR4      VP                  4       Kj  	  R# )
A records are loaded.
rO  N)r  z10.0.0.1)   no-in.example.comz10.0.0.2r  rA  r   r   r   r   r#   r0   rQ  ipr  s   &   r&   test_aRecords BindAuthorityTests.test_aRecords  sb    
GC "11$))2I2I#2NONTb2r 


r2   c                    V P                  V P                  P                  R4      4      w  w  pw   w   V P                  \        P
                  ! RR4      VP                  4       R# )
AAAA records are loaded.
r  2001:db8:10::1rO  Nr  rA  r  r   r   r  r#   r0   r  s   & r&   test_aaaaRecords#BindAuthorityTests.test_aaaaRecords  sY     --II''7
"r2 	OO  JJ	
r2   c                    V P                  V P                  P                  R4      4      w  w  pw   w   V P                  \        P
                  ! ^
RRR7      VP                  4       R# )
MX records are loaded.
rV  zmx.example.comrO  )rE  r>  rF   Nr  rA  r   r   r   r   r#   rh  s   & r&   test_mxRecords!BindAuthorityTests.test_mxRecords  s]     --II(()@A
"r2 	MM%
 JJ	
r2   c                    V P                  V P                  P                  R4      4      w  pw   w   V^ ,          pV P                  \        P
                  ! RRR7      VP                  4       R# )
CNAME records are loaded.
   www.example.comr(  rO  rD  Nr  rA  r  r   r   r   r#   r0   rb  r  s   &  r&   test_cnameRecords$BindAuthorityTests.test_cnameRecords  sd     !00II''(:;
"b QZ" JJ	
r2   c                    V P                  \        4      ;_uu_ 4       pV P                  R4       RRR4       V P                  RXP                  P
                  ^ ,          4       R#   + '       g   i     L?; i)z?
loadBindString raises NotImplementedError on invalid records.
s   example.com. IN LOL 192.168.0.1NzRecord type 'LOL' not supported)assertRaisesNotImplementedErrorrI  r   	exceptionr  )r0   es   & r&   test_invalidRecordClass*BindAuthorityTests.test_invalidRecordClass%  sU     233q BC 4:AKK<L<LQ<OP 43s   A''A7	c                4   R F~  pV P                  \        4      ;_uu_ 4       pV P                  VR,           4       RRR4       V P                  \	        VR,           4      XP
                  P                  ^ ,          4       K  	  R#   + '       g   i     LS; i)z3
$INCLUDE and $GENERATE raise NotImplementedError.
s    doesNotMatterNs    directive not implemented)s   $INCLUDEs	   $GENERATE)rx  ry  rI  r   r   rz  r  )r0   	directiver{  s   &  r&   test_invalidDirectives)BindAuthorityTests.test_invalidDirectives-  sp     5I""#6771##I0A$AB 8Y)FFG  # 577s   BBrA  N)r3   r4   r5   r6   r*  rI  r   rS  rY  rb  ri  rn  ru  r|  r  r7   r8   r9   s   @r&   rA  rA    sB     083
"

 
 Q
 
r2   rA  a  zone = [
    SOA(
        # For whom we are the authority
        'example.com',

        # This nameserver's name
        mname = "dns.example.com",

        # Mailbox of individual who handles this
        rname = "root.example.com",

        # Unique serial identifying this SOA data
        serial = 86400,

        # Time interval before zone should be refreshed
        refresh = "2H",

        # Interval before failed refresh should be retried
        retry = "1H",

        # Upper limit on time interval before expiry
        expire = "1H",

        # Minimum TTL
        minimum = "3H"

    ),

    AAAA('example.com', '2001:db8:10::1'),
    A('example.com', '10.0.0.1'),
    NS('example.com', 'dns.example.com'),
    A('no-in.example.com', '10.0.0.2'),
    PTR('2.0.0.10.in-addr.arpa', 'no-in.example.com'),

    CNAME('www.example.com', 'example.com'),
    CNAME('ftp.example.com', 'example.com'),

    MX('not-fqdn.example.com', 10, 'mail.example.com'),
]
c                   T   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
 tRtV tR# )PySourceAuthorityTestsie  z9
Tests for L{twisted.names.authority.PySourceAuthority}.
c                
   \        V P                  4       4      p\        VP                  R4      ;_uu_ 4       pVP	                  V4       RRR4       \
        P                  ! VP                  4      #   + '       g   i     L0; i)z
Create a new L{twisted.names.authority.PySourceAuthority} from C{s}.

@param s: A string with BIND zone data in a Python source file.
@type s: L{str}

@return: a new bind authority
@rtype: L{twisted.names.authority.PySourceAuthority}
r|  N)r   r/  r}  rF  writer   PySourceAuthority)r0   rG  rH  r3  s   &&  r&   loadPySourceString)PySourceAuthorityTests.loadPySourceStringj  sW     dkkm$"''31GGAJ   **27733  s   A22B	c                :    V P                  \        4      V n        R # r+   )r  samplePySourcerA  r   s   &r&   r   PySourceAuthorityTests.setUpz  s    ++N;	r2   c                    R Fg  w  rV P                  V P                  P                  V4      4      w  w  pw   w   V P                  \        P
                  ! V4      VP                  4       Ki  	  R# )r\  Nr]  r_  r`  s   &   r&   rb  $PySourceAuthorityTests.test_aRecords}  sZ    
GC "11$))2I2I#2NONTb2rR 


r2   c                    V P                  V P                  P                  R4      4      w  w  pw   w   V P                  \        P
                  ! R4      VP                  4       R# )re  r  rf  Nrg  rh  s   & r&   ri  'PySourceAuthorityTests.test_aaaaRecords  sR     --II''7
"r2 	OO,-JJ	
r2   c                    V P                  V P                  P                  R4      4      w  w  pw   w   V P                  \        P
                  ! ^
RR7      VP                  4       R# )rl  rV  zmail.example.com)rE  r>  Nrm  rh  s   & r&   rn  %PySourceAuthorityTests.test_mxRecords  sZ     --II(()@A
"r2 	MM' JJ	
r2   c                    V P                  V P                  P                  R4      4      w  pw   w   V^ ,          pV P                  \        P
                  ! RR7      VP                  4       R# )rq  rr  r(  r>  Nrs  rt  s   &  r&   ru  (PySourceAuthorityTests.test_cnameRecords  sa     !00II''(:;
"b QZ" JJ		
r2   c                    V P                  V P                  P                  R4      4      w  pw   w   V^ ,          pV P                  \        P
                  ! RR7      VP                  4       R# )z
PTR records are loaded.
s   2.0.0.10.in-addr.arpar^  r  N)r  rA  r   r   r   r   r#   rt  s   &  r&   r   PySourceAuthorityTests.test_PTR  s_     !00II##$<=
"b QZNN) JJ		
r2   c                L    RpV P                  \        V P                  V4       R# )z!
Input file has no zone variable
znothing = []N)rx  
ValueErrorr  )r0   badPySources   & r&   test_badInputNoZone*PySourceAuthorityTests.test_badInputNoZone  s!     %*d&=&={Kr2   r  N)r3   r4   r5   r6   r*  r  r   rb  ri  rn  ru  r   r  r7   r8   r9   s   @r&   r  r  e  s9     4 <




L Lr2   r  )Yr*  r   r  r   	functoolsr   r   ior   structr   twisted.internetr   r   r   twisted.internet.deferr	   twisted.internet.testingr
   r   r   twisted.namesr   r   r   r   r   twisted.names.clientr   twisted.names.dnsr   r   r   r   r   r   twisted.names.errorr   twisted.names.secondaryr   r   twisted.python.compatr   twisted.python.filepathr   twisted.trialr   r'   FileAuthorityr)   r   reverse_soar   r   r   r   r   r   r   r   r   r  r   r   r   r   r   r   r'  r  r   rs   r   rt   ru   TestCaserj   r,  r:  ro  r  r  r  r  r  rL  rA  r  r  r  r2   r&   <module>r     sg  
    %   2 2 * 
 A @ ) Q Q + Q . , "+.i-- . ^^

 
		
 nn
"
"
		 


'

 "	Z(LL&MM/*NNABNN13TUMM"45.IJ23MM45MM12NN35FGMM!]C0MM"l,?@MM!DFVWNNJKMM67]MJQ1IJMM28IJNN 2 24S Rz+O OOFG5
8 	$NN3u.FG&
 	 LL(LL("
 	$
 LL+,LL$&
 	!3#3#34F#G"H!CLL$<#=[.1f !	!;/$NN:;'
  	6"LL.MM-U3MM-T2NN3u.FDQ
W
X&& W
t
(## W5!! W5th// {/X&& {/|[5 1 1 [5|-XX.. -X`EDX%6%6 EDPj
h// j
Z+&~** ~B(VdLX.. dLr2   