CasperSecurity

Current Path : /lib/python3/dist-packages/twisted/test/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/twisted/test/__pycache__/test_postfix.cpython-310.pyc

o

�bK�@stdZddlmZmZmZddlmZddlmZddl	m
Z
Gdd�de
j�ZGdd	�d	�Z
Gd
d�de
e
j�ZdS)
z2
Test cases for twisted.protocols.postfix module.
�)�Dict�List�Tuple)�postfix)�StringTransport)�unittestc@seZdZgd�Zdd�ZdS)�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]%}|d}|dd�}|�t�|�|d�|D]}|�t�|�|�qqdS)Nr�)�data�assertEqualr�quote�unquote)�self�entry�raw�quoted�q�r�;/usr/lib/python3/dist-packages/twisted/test/test_postfix.py�testData!s
��z PostfixTCPMapQuoteTests.testDataN)�__name__�
__module__�__qualname__rrrrrrrsrc@sReZdZUiZeeefed<gZee	eefed<dd�Z
dd�Zdd�Zd	S)
�PostfixTCPMapServerTestCaser�chatc
Cs�t�|j�}t�}t��}||_||_|�|�|jD]\}}|�	|�|�
|��|d|||��f�|��q|�
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)r�PostfixTCPMapDictServerFactoryrr�PostfixTCPMapServer�service�factory�makeConnectionr�lineReceivedr�value�clear�
setTimeout�rr�	transport�protocol�input�expected_outputrrr�	test_chat4s"

��
z%PostfixTCPMapServerTestCase.test_chatcCs�t�|j�}t�}t��}||_||_|�|�|jD]\}}|�	|�|�
|��|d�|||����|�
�q|�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)r�'PostfixTCPMapDeferringDictServerFactoryrrrrrr rr!rr"�formatr#r$r%rrr�test_deferredChatMs"


��
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.
            cSstd��)NzThis is a test error)�	Exception)r�keyrrr�getrszGPostfixTCPMapServerTestCase.test_getException.<locals>.ErrorFactory.getN)rrr�__doc__r0rrrr�ErrorFactorymsr2sget examples400 This is a test error
N)rrrrr&r!rr")rr2�serverrrr�test_getExceptiongs
z-PostfixTCPMapServerTestCase.test_getExceptionN)
rrrrr�bytes�__annotations__rrrr*r-r4rrrrr+s
rc@seZdZddd�Zgd�ZdS)�
ValidTestss
ThisIs Foos bar really is found
)r	sbar)
)sgets&400 Command 'get' takes 1 parameters.
)sget foo bar�500 
)sput�&400 Command 'put' takes 2 parameters.
)sput foor9)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 bazr8)r	s400 unknown command
N)rrrrrrrrrr7|s
�r7N)r1�typingrrr�twisted.protocolsr�twisted.test.proto_helpersr�
twisted.trialr�TestCaserrr7rrrr�<module>sQ
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY