o
    ¯b¡  ã                   @   s2   d Z ddlmZ ddlmZ G dd„ dejƒZdS )z,
Tests for implementations of L{inetdconf}.
é    )Ú	inetdconf)Úunittestc                   @   s0   e Zd ZdZdZdZdd„ Zdd„ Zdd„ ZdS )	ÚServicesConfTestsz-
    Tests for L{inetdconf.ServicesConf}
    Nc                 C   s†   |   ¡ | _t| jdƒ�}| d¡ W d   ƒ n1 sw   Y  |   ¡ | _t| jdƒ�}| d¡ W d   ƒ d S 1 s<w   Y  d S )NÚwzÚ
            # This is a comment
            http            80/tcp          www www-http    # WorldWideWeb HTTP
            http            80/udp          www www-http
            http            80/sctp
            z]
            https           443/tcp                # http protocol over TLS/SSL
            )ÚmktempÚservicesFilename1ÚopenÚwriteÚservicesFilename2)ÚselfÚf© r   úD/usr/lib/python3/dist-packages/twisted/runner/test/test_inetdconf.pyÚsetUp   s   
ÿÿ
	ÿ"ÿzServicesConfTests.setUpc                 C   s:   t  ¡ }| j|_| ¡  |  |jddddddddœ¡ dS )z<
        Services are parsed from default filename.
        éP   ))ÚhttpÚtcp)r   Úudp)r   Úsctp)Úwwwr   )r   r   )úwww-httpr   )r   r   N)r   ÚServicesConfr   ÚdefaultFilenameÚ	parseFileÚassertEqualÚservices)r   Úconfr   r   r   Útest_parseDefaultFilename'   s   ùþz+ServicesConfTests.test_parseDefaultFilenamec                 C   sR   t  ¡ }t| jƒ�}| |¡ W d  ƒ n1 sw   Y  |  |jddi¡ dS )z9
        Services are parsed from given C{file}.
        N)Úhttpsr   i»  )r   r   r   r
   r   r   r   )r   r   r   r   r   r   Útest_parseFile;   s   ÿÿþz ServicesConfTests.test_parseFile)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r
   r   r   r   r   r   r   r   r      s    r   N)r#   Útwisted.runnerr   Útwisted.trialr   ÚTestCaser   r   r   r   r   Ú<module>   s   