o
    ¯bX	  ã                   @   sJ   d Z ddlmZ ddlmZ ddlmZ ddlm	Z	 G dd„ dej
ƒZdS )	z+
Tests for L{twisted.words.xmpproutertap}.
é    )Úinternet)Úunittest)Úxmpproutertap)Ú	componentc                   @   sD   e 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 )ÚXMPPRouterTapTestsc                 C   ó*   t  ¡ }| ddg¡ |  |d d¡ dS )z?
        The port option is recognised as a parameter.
        z--portÚ7001ÚportN©ÚtapÚOptionsÚparseOptionsÚassertEqual©ÚselfÚopt© r   úG/usr/lib/python3/dist-packages/twisted/words/test/test_xmpproutertap.pyÚ	test_port   ó   zXMPPRouterTapTests.test_portc                 C   s&   t  ¡ }| g ¡ |  |d d¡ dS )z=
        The port option has '5347' as default value
        r	   ztcp:5347:interface=127.0.0.1Nr
   r   r   r   r   Útest_portDefault   ó   
z#XMPPRouterTapTests.test_portDefaultc                 C   r   )zA
        The secret option is recognised as a parameter.
        z--secretÚhushhushÚsecretNr
   r   r   r   r   Útest_secret   r   zXMPPRouterTapTests.test_secretc                 C   s&   t  ¡ }| g ¡ |  |d d¡ dS )zA
        The secret option has 'secret' as default value
        r   Nr
   r   r   r   r   Útest_secretDefault'   r   z%XMPPRouterTapTests.test_secretDefaultc                 C   s&   t  ¡ }| dg¡ |  |d ¡ dS )z=
        The verbose option is recognised as a flag.
        ú	--verboseÚverboseN)r   r   r   Ú
assertTruer   r   r   r   Útest_verbose/   s   zXMPPRouterTapTests.test_verbosec                 C   sŒ   t  ¡ }| g ¡ t  |¡}|  |tj¡ |  d|jj	¡ |  d|jj
¡ |j}|  |tj¡ |  |jtj¡ |  d|j¡ |  |j¡ dS )zD
        The service gets set up with a router and factory.
        z	127.0.0.1iã  r   N)r   r   r   ÚmakeServiceÚassertIsInstancer   ÚStreamServerEndpointServicer   ÚendpointÚ
_interfaceÚ_portÚfactoryr   ÚXMPPComponentServerFactoryÚrouterÚRouterr   ÚassertFalseÚ
logTraffic)r   r   Úsr&   r   r   r   Útest_makeService7   s   

z#XMPPRouterTapTests.test_makeServicec                 C   s0   t  ¡ }| dg¡ t  |¡}|  |jj¡ dS )z;
        The verbose flag enables traffic logging.
        r   N)r   r   r   r    r   r&   r+   )r   r   r,   r   r   r   Útest_makeServiceVerboseG   s   
z*XMPPRouterTapTests.test_makeServiceVerboseN)
Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r-   r.   r   r   r   r   r      s    r   N)Ú__doc__Útwisted.applicationr   Útwisted.trialr   Útwisted.wordsr   r   Útwisted.words.protocols.jabberr   ÚTestCaser   r   r   r   r   Ú<module>   s   