o
    Óó·i\¿  ã                   @   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 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. 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)ÚMemoryReactorClockÚStringTransportÚwaitUntilAllDisconnected)Ú	authorityÚclientÚcommonÚdnsÚserver)ÚResolver)ÚSOAÚMessageÚQueryÚRecord_AÚ
Record_SOAÚRRHeader)ÚDomainError)ÚSecondaryAuthorityÚSecondaryAuthorityService)ÚnativeString)ÚFilePath)Úunittestc                 C   s   dd„ | d D ƒS )Nc                 S   s   g | ]}|j ‘qS © ©Úpayload©Ú.0Úrr   r   úcC:\Users\psant\Downloads\PAF backend\school\venv\Lib\site-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   ZResolverBaseÚ__init__ÚsoaÚrecords)Úselfr/   r0   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?   r@   rA   rB   rC   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)r6   s   http.tcp.test-domain.comó   host.test-domain.coms   host-two.test-domain.coms   cname.test-domain.coms   anothertest-domain.com©r/   r0   s   123.93.84.28.in-addr.arpas   test.host-reverse.lookup.coms   my-domain.comÚ1S©rD   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¡ qCq|| _|| _tjd|fgd�| _d S )Né   )Úverboser;   r   ú	127.0.0.1)Z	interface©Zservers)r   ZDNSServerFactoryÚtest_domain_comÚreverse_domainÚmy_domain_comÚfactoryr   ÚDNSDatagramProtocolr   Z	listenTCPZ
addCleanupÚstopListeningZgetHostÚportZ	listenUDPr   ZCannotListenErrorÚlistenerTCPÚlistenerUDPr   r   Úresolver)r1   Úpr{   rz   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)rw   ÚconnectionsÚ	transportZloseConnectionr   r   )r1   Ú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)ÚresponseZreceivedRecords©ÚexpectedRecordsr1   r   r%   ÚcheckResultsØ   s   z.ServerDNSTests.namesTest.<locals>.checkResultsN)ÚaddCallback)r1   Z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.comrr   r9   rl   N©r‹   r}   ÚlookupAddressr   r   ©r1   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 answersrO   z123.242.1.5r9   rl   z0.255.0.255NrŽ   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.254r9   rl   ú0.0.0.0NrŽ   r�   r   r   r%   Útest_addressRecord3ð   r•   z"ServerDNSTests.test_addressRecord3c                 C   s   |   | j d¡tg¡S )zTest DNS 'SOA' record queriesr�   N)r‹   r}   Z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.
        r6   rN   ri   r9   rl   rg   rh   N)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.39r9   rl   N)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�   rP   rQ   r9   )rR   rS   rD   N)r‹   r}   Z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.comrF   rl   N)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.comr9   rl   N)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.comr9   rl   N)r‹   r}   ZlookupMailBoxr   Ú	Record_MBr�   r   r   r%   Útest_MB.  r’   zServerDNSTests.test_MBc                 C   rŒ   )zTest DNS 'MG' record queriesr�   zmail.group.someplacer9   rl   N)r‹   r}   Z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.whateverr9   rl   N)r‹   r}   Z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 boxr9   )rZ   r[   rD   N)r‹   r}   Z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.comrd   re   rf   úsome.other.place.foolr9   rl   N)r‹   r}   Z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.comr9   )r\   r]   rD   N)r‹   r}   Z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.textr9   )r^   r_   rD   N)r‹   r}   Z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�   rT   rU   r9   rl   rY   N)r‹   r}   Z
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�   rK   r9   rl   rL   rM   N)r‹   r}   Z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.12r`   r9   rl   N)r‹   r}   Z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 )NrI   ú1.2.3.4rk   rl   z
ns1.domainZ2Mz
ns2.domainrm   rd   re   rf   r²   rn   )ÚcopyÚmy_soarB   rD   r‹   r}   ÚlookupAllRecordsr   r   rž   r³   )r1   Z
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:01FFr9   rl   N)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Ú r9   rl   rW   z	0:0069::0zsome.network.tldrX   z$0:5634:1294:AFCB:56AC:48EF:34C3:01FFztra.la.la.netN)r‹   r}   Z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˜   rB   r   ÚoperatorÚaddrt   r0   ÚvaluesrD   r‹   r}   Ú
lookupZonerŠ   )r1   Z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   rs   zimpossible.invalidN)r   ÚassertFailurerÑ   r   ZDNSLookupError)r1   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Á   r9   rl   NrŽ   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�   r7   rN   ra   rb   rc   r9   rl   N)r‹   r}   ZlookupNamingAuthorityPointerr   ÚRecord_NAPTRr�   r   r   r%   Ú
test_NAPTRß  s   
úÿþzServerDNSTests.test_NAPTRN)!r2   r3   r4   Ú__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%   ro   ˜   s>    


ro   c                   @   r+   )ÚHelperTestsc                 C   s@   |   ¡ }t |¡}tdƒD ]}t |¡}|  ||k ¡ |}qd S )Né   )Úmktempr   Z	getSerialÚrangeÚ
assertTrue)r1   ÚfÚaÚiÚbr   r   r%   Útest_serialGeneratoró  s   

ýz HelperTests.test_serialGeneratorN)r2   r3   r4   rã   r   r   r   r%   rÚ   ò  r5   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.comr7   éÈ   i,  i�  iô  iX  )r=   r>   r?   r@   rC   rB   rA   rD   ©ÚnameÚtypeÚclsrD   Úauthr!   é¼  úns.twistedmatrix.com©rè   rD   rN   zmail.mv3d.com)Ú
preferenceZexchangerD   z64.123.27.105)ÚaddressrD   )r)   r   ZDeferredÚdrŠ   Ú_gotResultsr   ZAXFRControllerÚ
controllerr   r   r   ÚINr   r/   ÚNSrž   ZMXr›   ÚAr   r0   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ÚanswerZopCodeZrecDesZrecAvrë   ZrCodeÚtruncZ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ô   Úqueriesr0   Úanswersró   ÚmessageReceivedr„   r)   )r1   Úmr   r   r%   Útest_bindAndTNamesStyle@  s
   z!AXFRTests.test_bindAndTNamesStylec                 C   s
   || _ d S r-   r(   )r1   Ú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   )	r0   rü   rþ   Úpoprÿ   ró   r   r„   r)   )r1   r0   r  r   r   r%   Útest_DJBStyleK  s   üzAXFRTests.test_DJBStyleN)r2   r3   r4   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©Zresolv©rr   rÓ   )rÜ   r   r   r„   Ú
dynServersÚ
_parseCallÚcancel©r1   Z
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Úwr  r	  )	rÜ   ÚopenÚcloser   r   r„   r
  r  r  r  r   r   r%   Ú
test_empty]  s
   z"ResolvConfHandlingTests.test_emptyN)r2   r3   r4   r  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)rt   r/   ÚfailureResultOfr�   ÚassertIsInstanceÚvaluer   )r1   Ú
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Á   rj   T©rD   r!   rë   N)r,   r˜   r=   rè   r   rž   ÚsuccessResultOfr�   r„   r   ÚTYPErB   )r1   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)rt   r/   Úmaxr   ÚtypeToMethodr  Úqueryr   r  r  r   )r1   r  r  Ú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;   rI   r   N)r!  r   r"  r  rv   r#  r   r„   )r1   r$  rú   r   r  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Á   rj   Fr  N)r˜   r=   rè   r   rž   r,   Úgetattrr  r„   r   rõ   rB   )r1   ÚmethodZ	subdomainZ
nameserverr   rñ   rú   r  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©r)  r�   r   r   r%   Útest_referralÓ  s   zAuthorityTests.test_referralc                 C   r*  )zT
        A referral is also generated for a request of type C{ALL_RECORDS}.
        rÄ   Nr+  r�   r   r   r%   Útest_allRecordsReferralÜ  s   z&AuthorityTests.test_allRecordsReferralN)r2   r3   r4   rÙ   r  r  r%  r&  r)  r,  r-  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}.
        rj   N)r,   r=   rè   r'  r˜   )r1   r(  r/   Ú
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)r1   ÚexpectedZcomputedr4  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 ©Tr  ©r   r   r  r˜   rB   ©r#   rð   ©r0  r   r%   r&   =  ó    ùûÿz=AdditionalProcessingTests._additionalTest.<locals>.<listcomp>N)r˜   r=   rè   r2  r  r7  )r1   r(  r/  r1  rñ   rú   r   r  r   r<  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š   rN   N)r>  r   r   r›   ©r1   r1  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)r@  Ú_Ar�   r   r   r%   Útest_mailExchangeAdditionalAU  ó   z6AdditionalProcessingTests.test_mailExchangeAdditionalAc                 C   rA  )z‡
        If the name of the MX response has AAAA records, they are included in
        the additional section of the response.
        N)r@  Ú_AAAAr�   r   r   r%   Útest_mailExchangeAdditionalAAAA\  rD  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)r@  rB  rE  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)r>  r   rž   r?  r   r   r%   Ú_additionalNSTestj  s   z+AdditionalProcessingTests._additionalNSTestc                 C   rA  )z„
        If the name of the NS response has A records, they are included in the
        additional section of the response.
        N)rJ  rB  r�   r   r   r%   Útest_nameserverAdditionalAs  rD  z4AdditionalProcessingTests.test_nameserverAdditionalAc                 C   rA  )z‡
        If the name of the NS response has AAAA records, they are included in
        the additional section of the response.
        N)rJ  rE  r�   r   r   r%   Útest_nameserverAdditionalAAAAz  rD  z7AdditionalProcessingTests.test_nameserverAdditionalAAAAc                 C   rG  )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)rJ  rB  rE  r�   r   r   r%   Útest_nameserverAdditionalBoth�  rI  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§   Tr  c              	      r8  r9  r:  r;  r<  r   r%   r&   �  r=  z>AdditionalProcessingTests._answerCNAMETest.<locals>.<listcomp>N)r˜   r=   rè   r2  r   r¨   r  r   ZCNAMErB   r7  )r1   r1  rñ   rú   r   r  Úaliasr   r<  r%   Ú_answerCNAMETestˆ  s(   ÿû
ø
öôz*AdditionalProcessingTests._answerCNAMETestc                 C   rA  )zƒ
        If the name of the CNAME response has A records, they are included in
        the answer section of the response.
        N)rO  rB  r�   r   r   r%   Útest_canonicalNameAnswerA«  rD  z3AdditionalProcessingTests.test_canonicalNameAnswerAc                 C   rA  )z†
        If the name of the CNAME response has AAAA records, they are included
        in the answer section of the response.
        N)rO  rE  r�   r   r   r%   Útest_canonicalNameAnswerAAAA²  rD  z6AdditionalProcessingTests.test_canonicalNameAnswerAAAAc                 C   rG  )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)rO  rB  rE  r�   r   r   r%   Útest_canonicalNameAnswerBoth¹  rI  z6AdditionalProcessingTests.test_canonicalNameAnswerBothN)r2   r3   r4   rÙ   r   r   rB  rÇ   rE  r2  r7  r>  r@  rC  rF  rH  rJ  rK  rL  rM  rO  rP  rQ  rR  r   r   r   r%   r.  ã  s&    

&#	#r.  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  )r1   Úargs©Úmessagesr   r%   r#  È  s   z3NoInitialResponseTests.test_noAnswer.<locals>.queryc                 _   s   t  t d¡¡S )NzCouldn't connect)r   Zfailr¾   Úgaierror)r1   rT  Úkwargsr   r   r%   ÚqueryProtocolÍ  ó   z;NoInitialResponseTests.test_noAnswer.<locals>.queryProtocol)r–   r   rs   r#  z	fooba.comrì   Frí   rî   rç   r÷   r;   r   rø   rå   N)r   Z_queryÚpatchr   rx   r   rõ   rô   rž   r   rÿ   ÚappendrÔ   ZgetHostByNamer¾   rW  )r1   r#  rY  r}   r0   r  r   rU  r%   Útest_noAnswerÂ  s:   úÿ
÷
z$NoInitialResponseTests.test_noAnswerN)r2   r3   r4   r]  r   r   r   r%   rS  Á  r5   rS  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©r1   ra  Ú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   ZfromServerAddressAndDomainsr„   ra  rb  rc  rd  )r1   ra  rz   rf  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.
        rh  rj  zexample.edur   r;   ri  N)r   Úencoder„   ra  rc  rd  re  r   r   r%   Ú test_constructAuthorityFromBytes#  s   þz?SecondaryAuthorityServiceTests.test_constructAuthorityFromBytesN)r2   r3   r4   rÙ   rg  rk  rm  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„   ra  rb  rd  ©r1   Ú	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.
        )ro  éé  rp  ro  ru  rq  N)r   ÚfromServerAddressAndDomainr„   ra  rb  rd  rr  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_  r8   úexample.comr   r_  r8   rp   N)r   rv  r
   Ú_reactorÚtransferÚ
tcpClientsr  r„   ÚbuildProtocolr   ÚmakeConnectionr   Údecoder   r  r   r   rý   rô   rþ   )r1   rs  r   Úhostrz   rw   Ú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.
        rx  r`  r   r;   )rú   rë   rp   Ns   ns1.example.comzadmin.example.comi@â i  iÀ  i   i€%  ià.  r<   s   192.168.1.2rl   )rù   rú   rë   )ré   r!   r    z!Hry  T)r!   rë   )r   rv  r
   rz  r{  r|  r  r}  r   r~  r   r  r   r  r   r   rù   rÿ   Úextendr   r   ZtoStrZdataReceivedr   Úlenr  r�   r„   )r1   rs  r   r€  rz   rw   r�  r‚  rƒ  r�   r#  r/   rà   rú   Údatar  r   r   r%   Útest_lookupAddresss  sF   ÿ
ø

ýÿÿz*SecondaryAuthorityTests.test_lookupAddressN)r2   r3   r4   rÙ   rt  rw  r…  r‰  r   r   r   r%   rn  9  s    
rn  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}
        ÚasciiN)r   rÜ   rl  Z
setContentr   ZBindAuthorityÚpath)r1   ÚsÚfpr   r   r%   ÚloadBindString¾  s   

z!BindAuthorityTests.loadBindStringc                 C   ó   |   t¡| _d S r-   )r�  ÚsampleBindZonerë   r�   r   r   r%   r   Í  rZ  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ë   r0   ÚkeysrÞ   rD   )r1   ÚdomZ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ë   ÚoriginZassertInr0   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©r  rë   r�   r„   r   r   r!   ©r1   r”  Úipr3  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©r  rë   rÆ   r„   r   rÇ   r!   ©r1   r3  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–  rN   zmx.example.comr’  )rï   rè   rD   N©r  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   ry  r’  rî   N©r  rë   rÆ   r„   r   r¨   r!   ©r1   rÿ   r3  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„   Ú	exceptionrT  )r1   Ú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¯  rT  )r1   Ú	directiver°  r   r   r%   Útest_invalidDirectives-  s   ÿ

þýz)BindAuthorityTests.test_invalidDirectivesN)r2   r3   r4   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}
        r  N)r   rÜ   r  rŒ  Úwriter   ZPySourceAuthority)r1   r�  rŽ  rß   r   r   r%   ÚloadPySourceStringj  s
   
ÿz)PySourceAuthorityTests.loadPySourceStringc                 C   r�  r-   )r¶  ÚsamplePySourcerë   r�   r   r   r%   r   z  rZ  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–  rN   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   ry  ©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)r  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¶  )r1   ZbadPySourcer   r   r%   Útest_badInputNoZoneÄ  s   z*PySourceAuthorityTests.test_badInputNoZoneN)r2   r3   r4   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   Ztwisted.internetr   r   r   Ztwisted.internet.deferr	   Ztwisted.internet.testingr
   r   r   Ztwisted.namesr   r   r   r   r   Ztwisted.names.clientr   Ztwisted.names.dnsr   r   r   r   r   r   Ztwisted.names.errorr   Ztwisted.names.secondaryr   r   Ztwisted.python.compatr   Ztwisted.python.filepathr   Ztwisted.trialr   r*   ZFileAuthorityr,   r˜   Zreverse_soarÃ   rž   r»   r›   r¡   r¨   rª   r¬   r¹   rÊ   r®   r°   rµ   r·   r½   r¿   r×   rÇ   r³   rt   r¥   ru   rv   ZTestCasero   rÚ   rä   r  r  r.  rS  r^  rn  r‘  rŠ  r·  r´  r   r   r   r%   Ú<module>   sü    øøù



ÿ
ÿæÿþ	ú

Óþ3þÿþûÿþ  \
Z~ _0Hm +