o
    ¯b^¿  ã                   @   sØ  d Z ddlZddlZddlZddlmZmZ ddlmZ ddl	m
Z
 ddlmZmZmZ ddlmZ ddlmZmZmZmZmZ dd	lmZ dd
lmZmZmZmZmZmZ ddl m!Z! ddl"m#Z#m$Z$ ddl%m&Z& ddl'm(Z( ddl)m*Z*m+Z+m,Z, ddl-m.Z. dd„ Z/G dd„ dej0ƒZ1ejddddddddd�Z2ejdddd d!d"d#d$d�Z3ejd%d&d'd(dd)dd*�Z4e1de2fe2e d+¡e 5d,¡e 6d-¡e 6d.d/¡e 7d0d1¡ej8d2d3d4�e 9d5¡e :d6¡e ;d7¡e <d8d9¡e =dd:d;¡e =d<d=d>¡e =d?d@dA¡e <dB¡e >dC¡ej?dDdEdF�ej@ddGdH�ejAdIdJdK�e BdLejCdM¡e Ddd0dNdOdP¡e EdQ¡ge FdRdSdTdU¡ge dV¡e dW¡ge dX¡e dY¡ge 9d¡ge dZ¡gd[œd\�ZGe1de3fd]e Hd^¡e3gid\�ZIe1d_e4fd_e4ejdZd`da�ej5dbdcda�ej5dddeda�ejFdRdSdTdUdfda�gid\�ZJG dgdh„ dhe.jKƒZLG didj„ dje.jKƒZMG dkdl„ dle.jKƒZNG dmdn„ dne.jKƒZOG dodp„ dpe.jKƒZPG dqdr„ dre.jKƒZQG dsdt„ dte.jKƒZRG dudv„ dve.jKƒZSG dwdx„ dxe.jKƒZTdyZUG dzd{„ d{e.jKƒZVd|ZWG d}d~„ d~e.jKƒZXdS )z
Test cases for twisted.names.
é    N)ÚpartialÚreduce)ÚBytesIO)Úpack)ÚdeferÚerrorÚreactor)Úsucceed)Ú	authorityÚclientÚcommonÚdnsÚserver)ÚResolver)ÚSOAÚMessageÚQueryÚRecord_AÚ
Record_SOAÚRRHeader)ÚDomainError)ÚSecondaryAuthorityÚSecondaryAuthorityService)ÚnativeString)ÚFilePath)ÚMemoryReactorClockÚStringTransportÚwaitUntilAllDisconnected)Úunittestc                 C   s   dd„ | d D ƒS )Nc                 S   s   g | ]}|j ‘qS © ©Úpayload©Ú.0Úrr   r   ú?/usr/lib/python3/dist-packages/twisted/names/test/test_names.pyÚ
<listcomp>"   ó    zjustPayload.<locals>.<listcomp>r   r   ©Úresultsr   r   r%   ÚjustPayload!   s   r*   c                   @   ó   e Zd Zdd„ ZdS )ÚNoFileAuthorityc                 C   s   t j | ¡ ||| _| _d S ©N)r   ÚResolverBaseÚ__init__ÚsoaÚrecords)Úselfr0   r1   r   r   r%   r/   &   s   zNoFileAuthority.__init__N)Ú__name__Ú
__module__Ú__qualname__r/   r   r   r   r%   r,   %   ó    r,   ó   test-domain.comzroot.test-domain.coméd   éÒ  iæ  éH?&é   é   ©ÚmnameÚrnameÚserialÚrefreshÚminimumÚexpireÚretryÚttls   93.84.28.in-addr.arpaéx   i1Ô  i~  éÎª é   é   úmy-domain.coms   postmaster.test-domain.comé‚   i90  i?B )r>   r?   r@   rA   rB   rC   rD   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::4321ó    é   s	   0:0069::0s   some.network.tldé   s$   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:01FFé  éÿ?  éªª  s   some.other.place.fooló   123.242.1.5ó   0.255.0.255s   255.255.255.254s   0.0.0.0s   1.2.3.4)r7   s   http.tcp.test-domain.comó   host.test-domain.coms   host-two.test-domain.coms   cname.test-domain.coms   anothertest-domain.com©r0   r1   s   123.93.84.28.in-addr.arpas   test.host-reverse.lookup.coms   my-domain.comÚ1S©rE   s
   ns1.domains   2Ms
   ns2.domainÚ3HÚ4Dc                   @   sø   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Zd&d'„ Zd(d)„ Zd*d+„ Zd,d-„ Zd.d/„ Zd0d1„ Zd2d3„ Zd4d5„ Zd6d7„ Zd8d9„ Zd:d;„ Z d<S )=ÚServerDNSTestsz/
    Test cases for DNS server and client.
    c                 C   sª   t jtttgdd�| _t | j¡}	 tj	d| jdd�}|  
|j¡ | ¡ j}z
tj||dd�}W n
 tjy:   Y nw |  
|j¡ nq|| _|| _tjd|fgd�| _d S )Né   )Úverboser<   r   ú	127.0.0.1)Ú	interface©Úservers)r   ÚDNSServerFactoryÚtest_domain_comÚreverse_domainÚmy_domain_comÚfactoryr   ÚDNSDatagramProtocolr   Ú	listenTCPÚ
addCleanupÚstopListeningÚgetHostÚportÚ	listenUDPr   ÚCannotListenErrorÚlistenerTCPÚlistenerUDPr   r   Úresolver)r2   Úpr„   r�   r…   r   r   r%   ÚsetUp�   s&   
ÿ
ÿïzServerDNSTests.setUpc                 C   s6   | j jdd… D ]}|j ¡  qtt| j jdd… ƒS )zu
        Clean up any server connections associated with the
        L{DNSServerFactory} created in L{setUp}
        N)r{   ÚconnectionsÚ	transportÚloseConnectionr   r   )r2   Úconnr   r   r%   ÚtearDown»   s   zServerDNSTests.tearDownc                    s   ‡ ‡fdd„}|  |¡ |S )aD  
        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                    s    t | ƒ}ˆ tˆ ƒt|ƒ¡ d S r-   )r*   ÚassertEqualÚset)ÚresponseÚreceivedRecords©ÚexpectedRecordsr2   r   r%   ÚcheckResultsØ   s   z.ServerDNSTests.namesTest.<locals>.checkResults)ÚaddCallback)r2   Úqueryingr“   r”   r   r’   r%   Ú	namesTestÈ   s   
zServerDNSTests.namesTestc                 C   ó    |   | j d¡tjddd�g¡S )z"Test simple DNS 'A' record queriesútest-domain.comrs   r:   rm   ©r—   r†   ÚlookupAddressr   r   ©r2   r   r   r%   Útest_addressRecord1ß   ó   
þz"ServerDNSTests.test_addressRecord1c                 C   ó,   |   | j d¡tjddd�tjddd�g¡S )z1Test DNS 'A' record queries with multiple answersrP   z123.242.1.5r:   rm   z0.255.0.255rš   rœ   r   r   r%   Útest_addressRecord2æ   ó   
þþz"ServerDNSTests.test_addressRecord2c                 C   rŸ   )z+Test DNS 'A' record queries with edge caseszhost-two.test-domain.comz255.255.255.254r:   rm   ú0.0.0.0rš   rœ   r   r   r%   Útest_addressRecord3ð   r¡   z"ServerDNSTests.test_addressRecord3c                 C   s   |   | j d¡tg¡S )zTest DNS 'SOA' record queriesr™   )r—   r†   ÚlookupAuthorityÚ
soa_recordrœ   r   r   r%   Útest_authorityú   s   ÿzServerDNSTests.test_authorityc              	   C   s:   |   | j d¡tjdddd�tjddd�tjddd�g¡S )z‹
        The DNS client can issue an MX query and receive a response including
        an MX record as well as any A record hints.
        r7   rO   rj   r:   rm   rh   ri   )r—   r†   ÚlookupMailExchanger   Ú	Record_MXr   rœ   r   r   r%   Útest_mailExchangeRecord   s   
ýþz&ServerDNSTests.test_mailExchangeRecordc                 C   r˜   )zTest DNS 'NS' record queriesr™   z39.28.189.39r:   rm   )r—   r†   ÚlookupNameserversr   Ú	Record_NSrœ   r   r   r%   Útest_nameserver  rž   zServerDNSTests.test_nameserverc                 C   ó"   |   | j d¡tjdddd�g¡S )zTest DNS 'HINFO' record queriesr™   rQ   rR   r:   )rS   rT   rE   )r—   r†   ÚlookupHostInfor   ÚRecord_HINFOrœ   r   r   r%   Ú
test_HINFO  ó   
ÿÿþzServerDNSTests.test_HINFOc                 C   r˜   )zTest DNS 'PTR' record queriesz123.93.84.28.in-addr.arpaztest.host-reverse.lookup.comrG   rm   )r—   r†   ÚlookupPointerr   Ú
Record_PTRrœ   r   r   r%   Útest_PTR   rž   zServerDNSTests.test_PTRc                 C   r˜   )zTest DNS 'CNAME' record queriesr™   zcanonical.name.comr:   rm   )r—   r†   ÚlookupCanonicalNamer   ÚRecord_CNAMErœ   r   r   r%   Ú
test_CNAME'  rž   zServerDNSTests.test_CNAMEc                 C   r˜   )zTest DNS 'MB' record queriesr™   zmailbox.test-domain.comr:   rm   )r—   r†   ÚlookupMailBoxr   Ú	Record_MBrœ   r   r   r%   Útest_MB.  rž   zServerDNSTests.test_MBc                 C   r˜   )zTest DNS 'MG' record queriesr™   zmail.group.someplacer:   rm   )r—   r†   ÚlookupMailGroupr   Ú	Record_MGrœ   r   r   r%   Útest_MG5  rž   zServerDNSTests.test_MGc                 C   r˜   )zTest DNS 'MR' record queriesr™   zmail.redirect.or.whateverr:   rm   )r—   r†   ÚlookupMailRenamer   Ú	Record_MRrœ   r   r   r%   Útest_MR<  rž   zServerDNSTests.test_MRc                 C   r­   )zTest DNS 'MINFO' record queriesr™   z
r mail boxz
e mail boxr:   )r[   r\   rE   )r—   r†   ÚlookupMailboxInfor   ÚRecord_MINFOrœ   r   r   r%   Ú
test_MINFOC  r±   zServerDNSTests.test_MINFOc              
   C   s&   |   | j d¡tjdddddd�g¡S )zTest DNS 'SRV' record querieszhttp.tcp.test-domain.comre   rf   rg   úsome.other.place.foolr:   rm   )r—   r†   ÚlookupServicer   Ú
Record_SRVrœ   r   r   r%   Útest_SRVN  s   
þzServerDNSTests.test_SRVc                 C   r­   )zTest DNS 'AFSDB' record queriesr™   r<   zafsdb.test-domain.comr:   )r]   r^   rE   )r—   r†   ÚlookupAFSDatabaser   ÚRecord_AFSDBrœ   r   r   r%   Ú
test_AFSDBU  r±   zServerDNSTests.test_AFSDBc                 C   r­   )zTest DNS 'RP' record queriesr™   zwhatever.i.dunnozsome.more.textr:   )r_   r`   rE   )r—   r†   ÚlookupResponsibilityr   Ú	Record_RPrœ   r   r   r%   Útest_RP`  r±   zServerDNSTests.test_RPc                 C   s.   |   | j d¡tjdddd�tjddd�g¡S )zTest DNS 'TXT' record queriesr™   rU   rV   r:   rm   rZ   )r—   r†   Ú
lookupTextr   Ú
Record_TXTrœ   r   r   r%   Útest_TXTk  s   
ÿÿüþzServerDNSTests.test_TXTc              	   C   s.   |   | j d¡tjddd�tjdddd�g¡S )zH
        L{DNSServerFactory} can serve I{SPF} resource records.
        r™   rL   r:   rm   rM   rN   )r—   r†   ÚlookupSenderPolicyr   Ú
Record_SPFrœ   r   r   r%   Útest_spfy  s   
ýþþzServerDNSTests.test_spfc              	   C   s&   |   | j d¡tjdtjddd�g¡S )zTest DNS 'WKS' record queriesr™   z12.54.78.12ra   r:   rm   )r—   r†   ÚlookupWellKnownServicesr   Ú
Record_WKSÚsocketÚIPPROTO_TCPrœ   r   r   r%   Útest_WKS‰  s   
üÿþzServerDNSTests.test_WKSc                 C   s^   t   t¡}tj|_|  | j d¡|tjddd�tj	ddd�tj	ddd�tj
d	d
dddd�g¡S )NrJ   ú1.2.3.4rl   rm   z
ns1.domainÚ2Mz
ns2.domainrn   re   rf   rg   rÄ   ro   )ÚcopyÚmy_soarC   rE   r—   r†   ÚlookupAllRecordsr   r   r«   rÆ   )r2   Ú
result_soar   r   r%   Útest_someRecordsWithTTLs—  s   

ûþz'ServerDNSTests.test_someRecordsWithTTLsc                 C   r˜   )z%Test DNS 'AAAA' record queries (IPv6)r™   z'AF43:5634:1294:AFCB:56AC:48EF:34C3:01FFr:   rm   )r—   r†   ÚlookupIPV6Addressr   ÚRecord_AAAArœ   r   r   r%   Ú	test_AAAA¥  rž   zServerDNSTests.test_AAAAc                 C   sD   |   | j d¡tjddddd�tjddd	dd�tjd
dddd�g¡S )z#Test DNS 'A6' record queries (IPv6)r™   r   z
ABCD::4321Ú r:   rm   rX   z	0:0069::0zsome.network.tldrY   z$0:5634:1294:AFCB:56AC:48EF:34C3:01FFztra.la.la.net)r—   r†   ÚlookupAddress6r   Ú	Record_A6rœ   r   r   r%   Útest_A6¬  s   
üýþzServerDNSTests.test_A6c                 C   sZ   t j}dd„ ttjtj ¡ ƒD ƒ}|D ]
}|jdu r||_q|  	| j
 d¡ dd„ ¡|¡S )z9
        Test DNS 'AXFR' queries (Zone transfer)
        c                 S   s   g | ]}t   |¡‘qS r   )rÛ   r"   r   r   r%   r&   Á  s    
ÿz4ServerDNSTests.test_zoneTransfer.<locals>.<listcomp>Nr™   c                 S   s   | d d d… fS )Nr   éÿÿÿÿr   )r$   r   r   r%   Ú<lambda>É  r'   z2ServerDNSTests.test_zoneTransfer.<locals>.<lambda>)r¥   rC   r   ÚoperatorÚaddrx   r1   ÚvaluesrE   r—   r†   Ú
lookupZoner•   )r2   Údefault_ttlr)   r$   r   r   r%   Útest_zoneTransfer¼  s   ÿ
€ÿüz ServerDNSTests.test_zoneTransferc                 C   s    t dgd�}|  | d¡tj¡S )zu
        A failed AXFR TCP connection errbacks the L{Deferred} returned
        from L{Resolver.lookupZone}.
        )znameserver.invalidé5   ru   zimpossible.invalid)r   ÚassertFailurerì   r   ÚDNSLookupError)r2   r†   r   r   r%   Ú test_zoneTransferConnectionFailsÎ  s   ÿz/ServerDNSTests.test_zoneTransferConnectionFailsc                 C   r˜   )z6Tests that unrelated zones don't mess with each other.zanothertest-domain.comrÙ   r:   rm   rš   rœ   r   r   r%   Útest_similarZonesDontInterfereØ  rž   z-ServerDNSTests.test_similarZonesDontInterferec                 C   s(   |   | j d¡tjddddddd�g¡S )	z2
        Test DNS 'NAPTR' record queries.
        r™   r8   rO   rb   rc   rd   r:   rm   )r—   r†   ÚlookupNamingAuthorityPointerr   ÚRecord_NAPTRrœ   r   r   r%   Ú
test_NAPTRß  s   
úÿþzServerDNSTests.test_NAPTRN)!r3   r4   r5   Ú__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ö   r   r   r   r%   rp   ˜   s>    


rp   c                   @   r+   )ÚHelperTestsc                 C   s@   |   ¡ }t |¡}tdƒD ]}t |¡}|  ||k ¡ |}qd S )Né   )Úmktempr
   Ú	getSerialÚrangeÚ
assertTrue)r2   ÚfÚaÚiÚbr   r   r%   Útest_serialGeneratoró  s   

ýz HelperTests.test_serialGeneratorN)r3   r4   r5   r  r   r   r   r%   rø   ò  r6   rø   c                   @   s4   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ ZdS )Ú	AXFRTestsc                 C   sÚ   d | _ t ¡ | _| j | j¡ t d| j¡| _t	j
dt	jt	jddt	jddddddd	d
d�d�| _| jt	j
dt	jt	jddt	jddd�d�t	j
dt	jt	jddt	jdddd�d�t	j
dt	jt	jddt	jddd�d�| jg| _d S )Nú	fooby.comi€Q Fzhooj.fooby.comr8   éÈ   i,  i�  iô  iX  )r>   r?   r@   rA   rD   rC   rB   rE   ©ÚnameÚtypeÚclsrE   Úauthr!   é¼  úns.twistedmatrix.com©r  rE   rO   zmail.mv3d.com)Ú
preferenceÚexchangerE   z64.123.27.105)ÚaddressrE   )r)   r   ÚDeferredÚdr•   Ú_gotResultsr   ÚAXFRControllerÚ
controllerr   r   r   ÚINr   r0   ÚNSr«   ÚMXr¨   ÚAr   r1   rœ   r   r   r%   rˆ   ý  s`   
øúúúú
æzAXFRTests.setUpc                 C   s   t jdddddddddd�	S )Néç  r<   r   ©	ÚidÚanswerÚopCodeÚrecDesÚrecAvr
  ÚrCodeÚtruncÚmaxSize)r   r   rœ   r   r   r%   Ú_makeMessage2  s   ÷zAXFRTests._makeMessagec                 C   sH   |   ¡ }t dtjtj¡g|_| j|_| j 	|d ¡ |  
| j| j¡ d S )Nr  )r$  r   r   ÚAXFRr  Úqueriesr1   Úanswersr  ÚmessageReceivedrŽ   r)   )r2   Úmr   r   r%   Útest_bindAndTNamesStyle@  s
   z!AXFRTests.test_bindAndTNamesStylec                 C   s
   || _ d S r-   r(   )r2   Úresultr   r   r%   r  H  s   
zAXFRTests._gotResultsc                 C   sT   | j d d … }|r |  ¡ }g |_| d¡g|_| j |d ¡ |s	|  | j| j ¡ d S ©Nr   )	r1   r$  r&  Úpopr'  r  r(  rŽ   r)   )r2   r1   r)  r   r   r%   Útest_DJBStyleK  s   üzAXFRTests.test_DJBStyleN)r3   r4   r5   rˆ   r$  r*  r  r.  r   r   r   r%   r  ü  s    5r  c                   @   s   e Zd Zdd„ Zdd„ ZdS )ÚResolvConfHandlingTestsc                 C   s2   |   ¡ }tj|d�}|  |jdg¡ |j ¡  d S )N©Úresolv©rs   rï   )rú   r   r   rŽ   Ú
dynServersÚ
_parseCallÚcancel©r2   Ú
resolvConfr$   r   r   r%   Útest_missingW  s   z$ResolvConfHandlingTests.test_missingc                 C   s@   |   ¡ }t|dƒ ¡  tj|d�}|  |jdg¡ |j ¡  d S )NÚwr0  r2  )	rú   ÚopenÚcloser   r   rŽ   r3  r4  r5  r6  r   r   r%   Ú
test_empty]  s
   z"ResolvConfHandlingTests.test_emptyN)r3   r4   r5   r8  r<  r   r   r   r%   r/  V  s    r/  c                   @   sH   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dS )ÚAuthorityTestszs
    Tests for the basic response record selection code in L{FileAuthority}
    (independent of its fileness).
    c                 C   s4   t }d|jd  }|  | |¡¡}|  |jt¡ dS )aJ  
        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-r   N)rx   r0   ÚfailureResultOfr›   ÚassertIsInstanceÚvaluer   )r2   Ú
testDomainÚtestDomainNamerþ   r   r   r%   Ú'test_domainErrorForNameWithCommonSuffixk  s   z6AuthorityTests.test_domainErrorForNameWithCommonSuffixc              
   C   s‚   t tjjtftjjtt d¡gid�}|  | tjj¡¡\}}}|  |g ¡ |  |tj	tjjtj
tjtdd�g¡ |  |g ¡ dS )a!  
        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Ù   rk   T©rE   r!   r
  N)r,   r¥   r>   r  r   r«   ÚsuccessResultOfr›   rŽ   r   ÚTYPErC   )r2   r
   r  Ú
additionalr   r   r%   Útest_recordMissingx  s0   
þÿþ	
ÿûÿþz!AuthorityTests.test_recordMissingc                 C   sJ   t }d|jd  }ttjƒd }|  | t||d�¡¡}|  |j	t
¡ dS )zˆ
        Requesting a record of unknown type where no records exist for the name
        in question results in L{DomainError}.
        r>  r   r<   ©r  r  N)rx   r0   Úmaxr   ÚtypeToMethodr?  Úqueryr   r@  rA  r   )r2   rB  rC  ÚunknownTyperþ   r   r   r%   Útest_unknownTypeNXDOMAINš  s   ÿz'AuthorityTests.test_unknownTypeNXDOMAINc                 C   s<   t tjƒd }|  t td|d�¡¡\}}}|  |g ¡ dS )z�
        Requesting a record of unknown type where other records exist for the
        name in question results in an empty answer set.
        r<   rJ   rJ  N)rK  r   rL  rF  rz   rM  r   rŽ   )r2   rN  r  r
   rH  r   r   r%   Útest_unknownTypeMissing§  s
   
ÿz&AuthorityTests.test_unknownTypeMissingc              
   C   sŒ   dt jj }t d¡}tt jjt f||gid�}t||ƒ|ƒ}|  |¡\}}}|  |g ¡ |  |tj	|tj
t j|dd�g¡ |  |g ¡ dS )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Ù   rk   FrE  N)r¥   r>   r  r   r«   r,   ÚgetattrrF  rŽ   r   r  rC   )r2   ÚmethodÚ	subdomainÚ
nameserverr
   r  r  rH  r   r   r%   Ú_referralTest²  s0   

ÿÿþûÿþzAuthorityTests._referralTestc                 C   ó   |   d¡ dS )a  
        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©rU  rœ   r   r   r%   Útest_referralÓ  s   zAuthorityTests.test_referralc                 C   rV  )zT
        A referral is also generated for a request of type C{ALL_RECORDS}.
        rÝ   NrW  rœ   r   r   r%   Útest_allRecordsReferralÜ  s   z&AuthorityTests.test_allRecordsReferralN)r3   r4   r5   r÷   rD  rI  rO  rP  rU  rX  rY  r   r   r   r%   r=  e  s    "!	r=  c                   @   sœ   e Zd ZdZe d¡Ze d¡Zdd„ Z	dd„ Z
dd	„ Zd
d„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"S )#ÚAdditionalProcessingTestszz
    Tests for L{FileAuthority}'s additional processing for those record types
    which require it (MX, CNAME, etc).
    s   10.0.0.1s   f080::1c                 C   s8   t |jj|f|jj||ƒg||id�}t||ƒtjjƒS )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}.
        rk   )r,   r>   r  rQ  r¥   )r2   rR  r0   Ú
makeRecordÚtargetÚ	addressesr
   r   r   r%   Ú_lookupSomeRecordsì  s   
þþz,AdditionalProcessingTests._lookupSomeRecordsc                 C   s(   dd„ }|   t||d�t||d�¡ dS )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                 S   s   | j S r-   )r  )Úrrr   r   r%   rè   $  s    z>AdditionalProcessingTests.assertRecordsMatch.<locals>.<lambda>)ÚkeyN)rŽ   Úsorted)r2   ÚexpectedÚcomputedr`  r   r   r%   ÚassertRecordsMatch  s    z,AdditionalProcessingTests.assertRecordsMatchc                    sL   dt jj ‰ |  |t |ˆ |¡}|  |¡\}}}|  ‡ fdd„|D ƒ|¡ dS )aT  
        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.c              	      ó$   g | ]}t jˆ |jtj|d d�‘qS ©TrE  ©r   r   rG  r¥   rC   ©r#   r  ©r\  r   r%   r&   =  ó    ùûÿz=AdditionalProcessingTests._additionalTest.<locals>.<listcomp>N)r¥   r>   r  r^  rF  rd  )r2   rR  r[  r]  r  r  r
   rH  r   ri  r%   Ú_additionalTest'  s   
ø
õz)AdditionalProcessingTests._additionalTestc                 C   s   |   dttjdƒ|¡ dS )z£
        Verify that a response to an MX query has certain records in the
        I{additional} section.

        @param addresses: See C{_additionalTest}
        r§   rO   N)rk  r   r   r¨   ©r2   r]  r   r   r%   Ú_additionalMXTestJ  s   ÿz+AdditionalProcessingTests._additionalMXTestc                 C   ó   |   | jg¡ dS )z„
        If the name of the MX response has A records, they are included in the
        additional section of the response.
        N)rm  Ú_Arœ   r   r   r%   Útest_mailExchangeAdditionalAU  ó   z6AdditionalProcessingTests.test_mailExchangeAdditionalAc                 C   rn  )z‡
        If the name of the MX response has AAAA records, they are included in
        the additional section of the response.
        N)rm  Ú_AAAArœ   r   r   r%   Útest_mailExchangeAdditionalAAAA\  rq  z9AdditionalProcessingTests.test_mailExchangeAdditionalAAAAc                 C   ó   |   | j| jg¡ dS )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)rm  ro  rr  rœ   r   r   r%   Útest_mailExchangeAdditionalBothc  ó   z9AdditionalProcessingTests.test_mailExchangeAdditionalBothc                 C   s   |   dtj|¡ dS )z£
        Verify that a response to an NS query has certain records in the
        I{additional} section.

        @param addresses: See C{_additionalTest}
        rª   N)rk  r   r«   rl  r   r   r%   Ú_additionalNSTestj  s   z+AdditionalProcessingTests._additionalNSTestc                 C   rn  )z„
        If the name of the NS response has A records, they are included in the
        additional section of the response.
        N)rw  ro  rœ   r   r   r%   Útest_nameserverAdditionalAs  rq  z4AdditionalProcessingTests.test_nameserverAdditionalAc                 C   rn  )z‡
        If the name of the NS response has AAAA records, they are included in
        the additional section of the response.
        N)rw  rr  rœ   r   r   r%   Útest_nameserverAdditionalAAAAz  rq  z7AdditionalProcessingTests.test_nameserverAdditionalAAAAc                 C   rt  )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)rw  ro  rr  rœ   r   r   r%   Útest_nameserverAdditionalBoth�  rv  z7AdditionalProcessingTests.test_nameserverAdditionalBothc                    sv   dt jj ‰ |  dt tjˆ |¡}|  |¡\}}}tjt jjtjt j	t ˆ ¡dd�}|  
‡ fdd„|D ƒ|g |¡ dS )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µ   TrE  c              	      re  rf  rg  rh  ri  r   r%   r&   �  rj  z>AdditionalProcessingTests._answerCNAMETest.<locals>.<listcomp>N)r¥   r>   r  r^  r   r¶   rF  r   ÚCNAMErC   rd  )r2   r]  r  r  r
   rH  Úaliasr   ri  r%   Ú_answerCNAMETestˆ  s(   ÿû
ø
öôz*AdditionalProcessingTests._answerCNAMETestc                 C   rn  )zƒ
        If the name of the CNAME response has A records, they are included in
        the answer section of the response.
        N)r}  ro  rœ   r   r   r%   Útest_canonicalNameAnswerA«  rq  z3AdditionalProcessingTests.test_canonicalNameAnswerAc                 C   rn  )z†
        If the name of the CNAME response has AAAA records, they are included
        in the answer section of the response.
        N)r}  rr  rœ   r   r   r%   Útest_canonicalNameAnswerAAAA²  rq  z6AdditionalProcessingTests.test_canonicalNameAnswerAAAAc                 C   rt  )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}  ro  rr  rœ   r   r   r%   Útest_canonicalNameAnswerBoth¹  rv  z6AdditionalProcessingTests.test_canonicalNameAnswerBothN)r3   r4   r5   r÷   r   r   ro  rá   rr  r^  rd  rk  rm  rp  rs  ru  rw  rx  ry  rz  r}  r~  r  r€  r   r   r   r%   rZ  ã  s&    

&#	#rZ  c                   @   r+   )ÚNoInitialResponseTestsc                    s    ‡ fdd„}dd„ }t dgd�}||_g ‰ |  tjd|¡ tjdtjtjd	d
tjdd	d�d�g}tj	dddddddddd�	}||_
ˆ  |¡ |  | d¡tj¡S )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                    s   t ˆ  d¡ƒS r,  )r	   r-  )r2   Úargs©Úmessagesr   r%   rM  È  s   z3NoInitialResponseTests.test_noAnswer.<locals>.queryc                 _   s   t  t d¡¡S )NzCouldn't connect)r   ÚfailrÖ   Úgaierror)r2   r‚  Úkwargsr   r   r%   ÚqueryProtocolÍ  ó   z;NoInitialResponseTests.test_noAnswer.<locals>.queryProtocol)r¢   r   ru   rM  z	fooba.comr  Fr  r  r  r  r<   r   r  r  )r   Ú_queryÚpatchr   r|   r   r  r  r«   r   r'  Úappendrð   ÚgetHostByNamerÖ   r†  )r2   rM  rˆ  r†   r1   r)  r   rƒ  r%   Útest_noAnswerÂ  s:   úÿ
÷
z$NoInitialResponseTests.test_noAnswerN)r3   r4   r5   rŽ  r   r   r   r%   r�  Á  r6   r�  c                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚSecondaryAuthorityServiceTestsz•
    Tests for L{SecondaryAuthorityService}, a service which keeps one or more
    authorities up to date by doing zone transfers from a master.
    c                 C   sª   d}t |ddgƒ}|  |j|¡ |  |jd¡ |  |jd j|¡ |  |jd jd¡ |  |jd jd¡ |  |jd j|¡ |  |jd jd¡ |  |jd jd¡ dS )	a  
        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.orgrï   r   r<   s   example.orgN)r   rŽ   ÚprimaryÚ_portÚdomainsÚdomain©r2   r’  Úservicer   r   r%   Útest_constructAuthorityFromHost÷  s   z>SecondaryAuthorityServiceTests.test_constructAuthorityFromHostc                 C   s´   d}d}t  ||fddg¡}|  |j|¡ |  |jd¡ |  |jd j|¡ |  |jd j|¡ |  |jd jd¡ |  |jd j|¡ |  |jd j|¡ |  |jd jd¡ dS )	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.edur   ó   example.netr<   N)r   ÚfromServerAddressAndDomainsrŽ   r’  r“  r”  r•  )r2   r’  r�   r—  r   r   r%   Ú&test_constructAuthorityFromHostAndPort  s   ÿzESecondaryAuthorityServiceTests.test_constructAuthorityFromHostAndPortc                 C   sx   d}t | ¡ ddgƒ}|  |j|¡ |  |jd j|¡ |  |jd jd¡ |  |jd j|¡ |  |jd jd¡ dS )aQ  
        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   r<   rš  N)r   ÚencoderŽ   r’  r”  r•  r–  r   r   r%   Ú test_constructAuthorityFromBytes#  s   þz?SecondaryAuthorityServiceTests.test_constructAuthorityFromBytesN)r3   r4   r5   r÷   r˜  r�  rŸ  r   r   r   r%   r�  ñ  s
    r�  c                   @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ÚSecondaryAuthorityTestsz—
    L{twisted.names.secondary.SecondaryAuthority} correctly constructs objects
    with a specified IP address and optionally specified DNS port.
    c                 C   s8   t ddƒ}|  |jd¡ |  |jd¡ |  |jd¡ dS )zp
        When constructed using L{SecondaryAuthority.__init__}, the default port
        of 53 is used.
        ú192.168.1.1ú
inside.comrï   ó
   inside.comN)r   rŽ   r’  r“  r•  ©r2   Ú	secondaryr   r   r%   Útest_defaultPort?  s   
z(SecondaryAuthorityTests.test_defaultPortc                 C   s:   t  dd¡}|  |jd¡ |  |jd¡ |  |jd¡ dS )z~
        When constructed using L{SecondaryAuthority.fromServerAddressAndDomain},
        the specified port is used.
        )r¡  éé  r¢  r¡  r§  r£  N)r   ÚfromServerAddressAndDomainrŽ   r’  r“  r•  r¤  r   r   r%   Útest_explicitPortI  s   ÿz)SecondaryAuthorityTests.test_explicitPortc                 C   s®   t  dd¡}tƒ  |_}| ¡  |j d¡\}}}}}|  |d¡ |  |d¡ | ||f¡}t	ƒ }	| 
|	¡ tƒ }
|
 t|	 ¡ dd… ƒ¡ |  t dtjtj¡g|
j¡ dS )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�  r9   úexample.comr   r�  r9   rq   N)r   r¨  r   Ú_reactorÚtransferÚ
tcpClientsr-  rŽ   ÚbuildProtocolr   ÚmakeConnectionr   Údecoder   rA  r   r   r%  r  r&  )r2   r¥  r   Úhostr�   r{   ÚtimeoutÚbindAddressÚprotorŠ   Úmsgr   r   r%   Útest_transferU  s   ÿ
"z%SecondaryAuthorityTests.test_transferc              
   C   s.  t  dd¡}tƒ  |_}| ¡  |j d¡\}}}}}| ||f¡}tƒ }	| 	|	¡ t
ddd�}
|
 t|	 ¡ dd… ƒ¡ tdd	d
dddddd�}tddd�}t
|
jddd�}|j tdt|d�td|d�tdt|d�g¡ | ¡ }| tdt|ƒƒ| ¡ |  | d¡¡}|  td|dd�gg g f|¡ dS )zŸ
        L{SecondaryAuthority.lookupAddress} returns a L{Deferred} that fires
        with the I{A} records the authority has cached from the primary.
        rª  r‘  r   r<   )r  r
  rq   Ns   ns1.example.comzadmin.example.comi@â i  iÀ  i   i€%  ià.  r=   s   192.168.1.2rm   )r  r  r
  )r  r!   r    z!Hr«  T)r!   r
  )r   r¨  r   r¬  r­  r®  r-  r¯  r   r°  r   r±  r   rA  r   r   r  r'  Úextendr   r   ÚtoStrÚdataReceivedr   ÚlenrF  r›   rŽ   )r2   r¥  r   r²  r�   r{   r³  r´  rµ  rŠ   rM  r0   rÿ   r  Údatar+  r   r   r%   Útest_lookupAddresss  sF   ÿ
ø

ýÿÿz*SecondaryAuthorityTests.test_lookupAddressN)r3   r4   r5   r÷   r¦  r©  r·  r½  r   r   r   r%   r   9  s    
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                   @   s`   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ ZdS )ÚBindAuthorityTestsz=
    Tests for L{twisted.names.authority.BindAuthority}.
    c                 C   s(   t |  ¡  d¡ƒ}| |¡ t |j¡S )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)r2   ÚsÚfpr   r   r%   ÚloadBindString¾  s   

z!BindAuthorityTests.loadBindStringc                 C   ó   |   t¡| _d S r-   )rÅ  ÚsampleBindZoner
  rœ   r   r   r%   rˆ   Í  r‰  zBindAuthorityTests.setUpc                 C   s8   | j j ¡ D ]}| j j| D ]
}|  d|jk¡ qqdS )zG
        Loads the default $TTL and applies it to all records.
        é€:	 N)r
  r1   Úkeysrý   rE   )r2   ÚdomÚrecr   r   r%   Útest_ttlÐ  s
   ÿÿzBindAuthorityTests.test_ttlc                 C   s$   |   d| jj¡ |  d| jj¡ dS )z,
        Loads the default $ORIGIN.
        s   example.com.ó   not-fqdn.example.comN)rŽ   r
  ÚoriginÚassertInr1   rœ   r   r   r%   Útest_originFromFileØ  s   þþz&BindAuthorityTests.test_originFromFilec                 C   sB   dD ]\}}|   | j |¡¡\\}\ \ |  t |d¡|j¡ qdS )ú'
        A records are loaded.
        ©)r‘  z10.0.0.1)ó   no-in.example.comz10.0.0.2rÈ  N©rF  r
  r›   rŽ   r   r   r!   ©r2   rÊ  Úipr_  r   r   r%   Útest_aRecordså  s   þûûz BindAuthorityTests.test_aRecordsc                 C   s4   |   | j d¡¡\\}\ \ |  t dd¡|j¡ dS )ú*
        AAAA records are loaded.
        r‘  ú2001:db8:10::1rÈ  N©rF  r
  rà   rŽ   r   rá   r!   ©r2   r_  r   r   r%   Útest_aaaaRecordsö  s   
ÿþûz#BindAuthorityTests.test_aaaaRecordsc                 C   s8   |   | j d¡¡\\}\ \ |  tjdddd�|j¡ dS )ú(
        MX records are loaded.
        rÍ  rO   zmx.example.comrÈ  )r  r  rE   N©rF  r
  r§   rŽ   r   r¨   r!   rÛ  r   r   r%   Útest_mxRecords  s   
ÿýúz!BindAuthorityTests.test_mxRecordsc                 C   s<   |   | j d¡¡\}\ \ |d }|  tjddd�|j¡ dS )ú+
        CNAME records are loaded.
        ó   www.example.comr   r«  rÈ  r  N©rF  r
  rà   rŽ   r   r¶   r!   ©r2   r'  r_  r   r   r%   Útest_cnameRecords  s   

ÿþûz$BindAuthorityTests.test_cnameRecordsc                 C   sL   |   t¡�}|  d¡ W d  ƒ n1 sw   Y  |  d|jjd ¡ dS )zO
        loadBindString raises NotImplementedError on invalid records.
        s   example.com. IN LOL 192.168.0.1NzRecord type 'LOL' not supportedr   )ÚassertRaisesÚNotImplementedErrorrÅ  rŽ   Ú	exceptionr‚  )r2   Úer   r   r%   Útest_invalidRecordClass%  s   ÿz*BindAuthorityTests.test_invalidRecordClassc              	   C   sb   dD ],}|   t¡�}|  |d ¡ W d  ƒ n1 sw   Y  |  t|d ƒ|jjd ¡ qdS )zC
        $INCLUDE and $GENERATE raise NotImplementedError.
        )s   $INCLUDEs	   $GENERATEs    doesNotMatterNs    directive not implementedr   )rå  ræ  rÅ  rŽ   r   rç  r‚  )r2   Ú	directiverè  r   r   r%   Útest_invalidDirectives-  s   ÿ

þýz)BindAuthorityTests.test_invalidDirectivesN)r3   r4   r5   r÷   rÅ  rˆ   rÌ  rÐ  r×  rÜ  rß  rä  ré  rë  r   r   r   r%   r¾  ¹  s    r¾  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                   @   sP   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ ZdS )ÚPySourceAuthorityTestszA
    Tests for L{twisted.names.authority.PySourceAuthority}.
    c                 C   sN   t |  ¡ ƒ}t|jdƒ�}| |¡ W d  ƒ n1 sw   Y  t |j¡S )a  
        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}
        r9  N)r   rú   r:  rÂ  Úwriter
   ÚPySourceAuthority)r2   rÃ  rÄ  rþ   r   r   r%   ÚloadPySourceStringj  s
   
ÿz)PySourceAuthorityTests.loadPySourceStringc                 C   rÆ  r-   )rï  ÚsamplePySourcer
  rœ   r   r   r%   rˆ   z  r‰  zPySourceAuthorityTests.setUpc                 C   s@   dD ]\}}|   | j |¡¡\\}\ \ |  t |¡|j¡ qdS )rÑ  rÒ  NrÔ  rÕ  r   r   r%   r×  }  s   þûz$PySourceAuthorityTests.test_aRecordsc                 C   s2   |   | j d¡¡\\}\ \ |  t d¡|j¡ dS )rØ  r‘  rÙ  NrÚ  rÛ  r   r   r%   rÜ  ‹  s   
ÿþz'PySourceAuthorityTests.test_aaaaRecordsc                 C   s6   |   | j d¡¡\\}\ \ |  tjddd�|j¡ dS )rÝ  rÍ  rO   zmail.example.com)r  r  NrÞ  rÛ  r   r   r%   rß  —  s   
ÿþûz%PySourceAuthorityTests.test_mxRecordsc                 C   ó:   |   | j d¡¡\}\ \ |d }|  tjdd�|j¡ dS )rà  rá  r   r«  ©r  Nrâ  rã  r   r   r%   rä  ¦  ó   

ÿÿüz(PySourceAuthorityTests.test_cnameRecordsc                 C   rñ  )z)
        PTR records are loaded.
        s   2.0.0.10.in-addr.arpar   rÓ  rò  N)rF  r
  r²   rŽ   r   r³   r!   rã  r   r   r%   r´   µ  ró  zPySourceAuthorityTests.test_PTRc                 C   s   d}|   t| j|¡ dS )z1
        Input file has no zone variable
        znothing = []N)rå  Ú
ValueErrorrï  )r2   ÚbadPySourcer   r   r%   Útest_badInputNoZoneÄ  s   z*PySourceAuthorityTests.test_badInputNoZoneN)r3   r4   r5   r÷   rï  rˆ   r×  rÜ  rß  rä  r´   rö  r   r   r   r%   rì  e  s    rì  )Yr÷   rÛ   ré   rÖ   Ú	functoolsr   r   Úior   Ústructr   Útwisted.internetr   r   r   Útwisted.internet.deferr	   Ú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.test.proto_helpersr   r   r   Ú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Æ   rx   r³   ry   rz   ÚTestCaserp   rø   r  r/  r=  rZ  r�  r�  r   rÇ  r¾  rð  rì  r   r   r   r%   Ú<module>   sü    øøù



ÿ
ÿæÿþ	ú

Óþ3þÿþûÿþ  \
Z~ _0Hm +