HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/twisted/names/test/__pycache__/test_tap.cpython-38.pyc
U


W[a�@s�dZddlmZddlmZddlmZddlmZddl	m
Z
ddlmZm
Z
ddlmZdd	lmZdd
lmZddlmZGdd
�d
e�ZdS)z!
Tests for L{twisted.names.tap}.
�)�ThreadedResolver)�Resolver)�PORT)�
ResolverChain)�SecondaryAuthorityService)�Options�_buildResolvers)�_PY3)�platform)�
UsageError)�SynchronousTestCasec@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�OptionsTestszf
    Tests for L{Options}, defining how command line arguments for the DNS server
    are parsed.
    cCsZt�}|�t|jddg�|�t|jddg�|�t|jddg�|�t|jddg�dS)z�
        If the value supplied for an I{--secondary} option does not provide a
        server IP address, optional port number, and domain name,
        L{Options.parseOptions} raises L{UsageError}.
        �--secondary��1.2.3.4z
1.2.3.4:helloz1.2.3.4:hello/example.comN)rZassertRaisesr�parseOptions��self�options�r�=/usr/lib/python3/dist-packages/twisted/names/test/test_tap.py�test_malformedSecondarys*����z$OptionsTests.test_malformedSecondarycCs2t�}|�ddg�|�dtfdgfg|j�dS)z�
        An argument of the form C{"ip/domain"} is parsed by L{Options} for the
        I{--secondary} option and added to its list of secondaries, using the
        default DNS port number.
        rz1.2.3.4/example.comr�example.comN)rr�assertEqualr�secondariesrrrr�test_secondary,s�zOptionsTests.test_secondarycCs.t�}|�ddg�|�ddgfg|j�dS)z�
        An argument of the form C{"ip:port/domain"} can be used to specify an
        alternate port number for which to act as a secondary.
        r�1.2.3.4:5353/example.com)r��rN)rrrrrrrr�test_secondaryExplicitPort8s
�z'OptionsTests.test_secondaryExplicitPortcCs�t�}|�ddddg�|�t|j�d�|jd}|�|jdt�|�|jd�|�|jd�|jd}|�|jdt�|�|jd	�|�|jd
�dS)z�
        After parsing I{--secondary} options, L{Options} constructs a
        L{SecondaryAuthorityService} instance for each configured secondary.
        rrz1.2.3.5:5354/example.com�rrr�z1.2.3.5i�N)	rrr�lenZsvcs�assertIsInstancerZprimaryZ_port)rrZ	secondaryrrr�test_secondaryAuthorityServicesCs�

z,OptionsTests.test_secondaryAuthorityServicescCs�t�}|�dddg�t|�\}}|D],}t|t�r&|jd}t|t�r&|j��q&t	�
�dkr�ddlm}|j
D]8}tr�|�|jjtj�n|�|jjtjj�|��qr|�|dt�dS)	z�
        Recursive DNS lookups, if enabled, should be a last-resort option.
        Any other lookup method (cache, local lookup, etc.) should take
        precedence over recursive lookups
        z--hosts-filez	hosts.txtz--recursive����posixr)�reactorN)rrr�
isinstancerZ	resolversrZ
_parseCallZcancelr
ZgetTypeZtwisted.internetr&Z_newTimedCallsr	r�func�__func__rZ_cleanupr")rrZcaZcl�xZrecurserr&rrr�test_recursiveConfigurationVs(




�
�
z(OptionsTests.test_recursiveConfigurationN)	�__name__�
__module__�__qualname__�__doc__rrrr#r+rrrrr
sr
N)r/Ztwisted.internet.baserZtwisted.names.clientrZtwisted.names.dnsrZtwisted.names.resolverZtwisted.names.secondaryrZtwisted.names.taprrZtwisted.python.compatr	Ztwisted.python.runtimer
Ztwisted.python.usagerZtwisted.trial.unittestrr
rrrr�<module>s