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/test/__pycache__/test_postfix.cpython-38.pyc
U


W[��@sbdZddlmZddlmZddlmZGdd�dej�ZGdd�de	�Z
Gd	d
�d
e
ej�ZdS)z2
Test cases for twisted.protocols.postfix module.
�)�unittest)�postfix)�StringTransportc@s&eZdZdddddddgZdd	�Zd
S)�PostfixTCPMapQuoteTests)�foor)sfoo bars	foo%20bar)sfoo	bars	foo%09bar)sfoo
bars	foo%0Abars	foo%0abar)sfoo
barsfoo%0D%0Abarsfoo%0D%0abarsfoo%0d%0Abarsfoo%0d%0abar)sfoo sfoo%20)s foos%20foocCsV|jD]J}|d}|dd�}|�t�|�|d�|D]}|�t�|�|�q8qdS)Nr�)�data�assertEqualrZquoteZunquote)�self�entry�rawZquoted�q�r�;/usr/lib/python3/dist-packages/twisted/test/test_postfix.py�testDatas
z PostfixTCPMapQuoteTests.testDataN)�__name__�
__module__�__qualname__rrrrrrr
s�rc@s,eZdZiZgZdd�Zdd�Zdd�ZdS)�PostfixTCPMapServerTestCasec
Cs�t�|j�}t�}t��}||_||_|�|�|jD]:\}}|�	|�|�
|��|d|||��f�|��q6|�
d�dS)z�
        Test that I{get} and I{put} commands are responded to correctly by
        L{postfix.PostfixTCPMapServer} when its factory is an instance of
        L{postifx.PostfixTCPMapDictServerFactory}.
        zFor %r, expected %r but got %rN)rZPostfixTCPMapDictServerFactoryrr�PostfixTCPMapServer�service�factory�makeConnection�chat�lineReceivedr	�value�clear�
setTimeout�r
r�	transportZprotocol�inputZexpected_outputrrr�	test_chat/s&

��
z%PostfixTCPMapServerTestCase.test_chatcCs�t�|j�}t�}t��}||_||_|�|�|jD]:\}}|�	|�|�
|��|d�|||����|�
�q6|�d�dS)z�
        Test that I{get} and I{put} commands are responded to correctly by
        L{postfix.PostfixTCPMapServer} when its factory is an instance of
        L{postifx.PostfixTCPMapDeferringDictServerFactory}.
        z$For {!r}, expected {!r} but got {!r}N)rZ'PostfixTCPMapDeferringDictServerFactoryrrrrrrrrr	r�formatrrrrrr�test_deferredChatGs&

��
z-PostfixTCPMapServerTestCase.test_deferredChatcCsFGdd�d�}t��}|�|_t�|_|�d�|�|j��d�dS)z^
        If the factory throws an exception,
        error code 400 must be returned.
        c@seZdZdZdd�ZdS)zCPostfixTCPMapServerTestCase.test_getException.<locals>.ErrorFactoryzE
            Factory that raises an error on key lookup.
            cSstd��dS)NzThis is a test error)�	Exception)r
�keyrrr�gethszGPostfixTCPMapServerTestCase.test_getException.<locals>.ErrorFactory.getN)rrr�__doc__r&rrrr�ErrorFactorydsr(sget examples400 This is a test error
N)rrrrrrr	r)r
r(Zserverrrr�test_getException_s
�z-PostfixTCPMapServerTestCase.test_getExceptionN)rrrrrr!r#r)rrrrr%s
rc
@s.eZdZddd�Zdddddd	d
ddd
g
ZdS)�
ValidTestss
ThisIs Foos bar really is found
)rsbar)sgets&400 Command 'get' takes 1 parameters.
)sget foo bar�500 
)sput�&400 Command 'put' takes 2 parameters.
)sput foor,)sput foo bar baz� 500 put is not implemented yet.
)sput foo barr-)sget foos200 ThisIs%20Foo
)sget bars'200 %20bar%20really%20is%20found%0D%0A
)sget bazr+)rs400 unknown command
N)rrrrrrrrrr*ts��r*N)r'Z
twisted.trialrZtwisted.protocolsrZtwisted.test.proto_helpersrZTestCaser�objectrr*rrrr�<module>sO