U
    n5{i©  ã                   @   sL   d Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	 G dd„ de	ƒZ
dS )	z,
Tests for L{twisted.application.strports}.
é    )ÚinternetÚstrports)ÚTCP4ServerEndpoint)ÚFactory)ÚTestCasec                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚServiceTestsz(
    Tests for L{strports.service}.
    c                 C   s‚   t ƒ }tƒ }d}tjdt|ƒ ||d�}|  |tj¡ |  |j	¡ |  |j
t¡ |  |j
j|¡ |  |j|¡ |  |j
j|¡ dS )z¾
        L{strports.service} returns a L{StreamServerEndpointService}
        constructed with an endpoint produced from
        L{endpoint.serverFromString}, using the same syntax.
        i9  ztcp:©ÚreactorN)Úobjectr   r   ÚserviceÚstrZassertIsInstancer   ZStreamServerEndpointServiceÚ
assertTrueZ_raiseSynchronouslyÚendpointr   ÚassertEqualZ_portÚassertIsÚfactoryÚ_reactor)Úselfr	   ZaFactoryZ	aGoodPortZsvc© r   ú>/tmp/pip-unpacked-wheel-mnhg7r0q/twisted/test/test_strports.pyÚtest_service   s    zServiceTests.test_servicec                 C   s,   ddl m} t dd¡}|  |jj|¡ dS )zp
        L{strports.service} will use the default reactor when none is provided
        as an argument.
        r   r   ztcp:80N)Ztwisted.internetr	   r   r   r   r   r   )r   ZglobalReactorZaServicer   r   r   Útest_serviceDefaultReactor)   s    z'ServiceTests.test_serviceDefaultReactorN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r      s   r   N)r   Ztwisted.applicationr   r   Ztwisted.internet.endpointsr   Ztwisted.internet.protocolr   Ztwisted.trial.unittestr   r   r   r   r   r   Ú<module>   s
   