o
    Óó·i�	  ã                   @   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                   @   sR   e Zd Zddd„Zddd„Zddd„Zdd	d
„Zddd„Zddd„Zddd„Z	dS )ÚXMPPRouterTapTestsÚreturnNc                 C   ó*   t  ¡ }| ddg¡ |  |d d¡ dS )z?
        The port option is recognised as a parameter.
        z--portZ7001ÚportN©ÚtapÚOptionsÚparseOptionsÚassertEqual©ÚselfÚopt© r   úkC:\Users\psant\Downloads\PAF backend\school\venv\Lib\site-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--secretZ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   ÚmakeServiceZassertIsInstancer   ZStreamServerEndpointServicer   ZendpointZ
_interfaceZ_portÚfactoryr   ZXMPPComponentServerFactoryZrouterZRouterr   Z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_makeServiceVerbose)r   N)
Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r#   r$   r   r   r   r   r      s    





r   N)Ú__doc__Ztwisted.applicationr   Ztwisted.trialr   Ztwisted.wordsr   r   Ztwisted.words.protocols.jabberr   ZTestCaser   r   r   r   r   Ú<module>   s   