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: //lib/python3/dist-packages/twisted/protocols/haproxy/test/__pycache__/test_parser.cpython-38.pyc
U


W[�
�@sxdZddlmZddlmZddlmZmZm	Z	m
Z
mZmZ
ddlmZddlmZGdd	�d	e�ZGd
d�de�ZdS)
z1
Tests for L{twisted.protocols.haproxy._parser}.
�)�SynchronousTestCase)�
MemoryReactor)�_WrapperServerEndpoint�TCP4ServerEndpoint�TCP6ServerEndpoint�UNIXServerEndpoint�serverFromString�_parse�)�HAProxyWrappingFactory)�unparseEndpointc@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�UnparseEndpointTestszg
    Tests to ensure that un-parsing an endpoint string round trips through
    escaping properly.
    cCs|�tt|��|�dS)aA
        Check that the input unparses into the output, raising an assertion
        error if it doesn't.

        @param input: an input in endpoint-string-description format.  (To
            ensure determinism, keyword arguments should be in alphabetical
            order.)
        @type input: native L{str}
        N)ZassertEqualr�
parseEndpoint)�self�input�r�L/usr/lib/python3/dist-packages/twisted/protocols/haproxy/test/test_parser.py�checks
zUnparseEndpointTests.checkcCs|�d�dS)z%
        An individual word.
        ZwordN�r�rrrr�test_basicUnparse'sz&UnparseEndpointTests.test_basicUnparsecCs|�d�dS)z%
        Multiple arguments.
        zone:twoNrrrrr�test_multipleArguments.sz+UnparseEndpointTests.test_multipleArgumentscCs|�d�dS)z$
        Keyword arguments.
        zaleph=one:bet=twoNrrrrr�
test_keywords5sz"UnparseEndpointTests.test_keywordscCs|�d�dS)z
        Escaped ":".
        zhello\:colon\:worldNrrrrr�test_colonInArgument<sz)UnparseEndpointTests.test_colonInArgumentcCs|�d�dS)z/
        Escaped ":" in keyword value.
        zhello=\:Nrrrrr�test_colonInKeywordValueCsz-UnparseEndpointTests.test_colonInKeywordValuecCs|�d�dS)z.
        Escaped ":" in keyword name.
        z\:=helloNrrrrr�test_colonInKeywordNameJsz,UnparseEndpointTests.test_colonInKeywordNameN)�__name__�
__module__�__qualname__�__doc__rrrrrrrrrrrr
s
r
c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�HAProxyServerParserTestsz@
    Tests that the parser generates the correct endpoints.
    cCs<t�}t||�}|�|t�|�|j|�|�|jt�|S)a%
        Test the C{haproxy} enpdoint prefix against one sub-endpoint type.

        @param description: A string endpoint description beginning with
            C{haproxy}.
        @type description: native L{str}

        @param expectedClass: the expected sub-endpoint class given the
            description.
        @type expectedClass: L{type}

        @return: the parsed endpoint
        @rtype: L{IStreamServerEndpoint}

        @raise twisted.trial.unittest.Failtest: if the parsed endpoint doesn't
            match expectations.
        )rrZassertIsInstancerZ_wrappedEndpointZassertIsZ_wrapperFactoryr)rZdescriptionZ
expectedClassZreactorZendpointrrr�	onePrefixWs
z"HAProxyServerParserTests.onePrefixcCs|�dt�dS)zG
        Test if the parser generates a wrapped TCP4 endpoint.
        zhaproxy:tcp:8080N)r!rrrrr�	test_tcp4qsz"HAProxyServerParserTests.test_tcp4cCs|�dt�dS)zG
        Test if the parser generates a wrapped TCP6 endpoint.
        zhaproxy:tcp6:8080N)r!rrrrr�	test_tcp6xsz"HAProxyServerParserTests.test_tcp6cCs|�dt�dS)zG
        Test if the parser generates a wrapped UNIX endpoint.
        z haproxy:unix:address=/tmp/socketN)r!rrrrr�	test_unixsz"HAProxyServerParserTests.test_unixN)rrrrr!r"r#r$rrrrr Rs
r N)rZtwisted.trial.unittestrZTestCaseZtwisted.test.proto_helpersrZtwisted.internet.endpointsrrrrrr	rZ_wrapperrZ_parserrr
r rrrr�<module>s >