§
    ÈtºfI  ã                   óª   — d Z ddlmZmZmZ ddlmZ ddlmZ ddl	m
Z
  G d„ de
j        ¦  «        Z G d„ d	¦  «        Z G d
„ dee
j        ¦  «        ZdS )z2
Test cases for twisted.protocols.postfix module.
é    )ÚDictÚListÚTuple)ÚStringTransport)Úpostfix)Úunittestc                   ó   — e Zd Zg d¢Zd„ ZdS )ÚPostfixTCPMapQuoteTests))ó   foor   )s   foo bars	   foo%20bar)s   foo	bars	   foo%09bar)s   foo
bars	   foo%0Abars	   foo%0abar)s   foo
bars   foo%0D%0Abars   foo%0D%0abars   foo%0d%0Abars   foo%0d%0abar)s   foo s   foo%20)s    foos   %20fooc                 óô   — | j         D ]o}|d         }|dd …         }|                      t          j        |¦  «        |d         ¦  «         |D ]*}|                      t          j        |¦  «        |¦  «         Œ+Œpd S )Nr   é   )ÚdataÚassertEqualr   ÚquoteÚunquote)ÚselfÚentryÚrawÚquotedÚqs        úX/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/test/test_postfix.pyÚtestDataz PostfixTCPMapQuoteTests.testData!   sŽ   € Ø”Yð 	:ð 	:ˆEØ˜”(ˆCØ˜1˜2˜2”YˆFà×Ò�Wœ]¨3Ñ/Ô/°¸´Ñ;Ô;Ð;Øð :ð :�Ø× Ò ¥¤°Ñ!3Ô!3°SÑ9Ô9Ð9Ð9ð:ð	:ð 	:ó    N)Ú__name__Ú
__module__Ú__qualname__r   r   © r   r   r
   r
      s4   € € € € € ðð ð €Dð":ð :ð :ð :ð :r   r
   c                   ój   — e Zd ZU i Zeeef         ed<   g Zee	eef                  ed<   d„ Z
d„ Zd„ ZdS )ÚPostfixTCPMapServerTestCaser   Úchatc                 óÞ  — t          j        | j        ¦  «        }t          ¦   «         }t          j        ¦   «         }||_        ||_        |                     |¦  «         | j        D ]r\  }}| 	                    |¦  «         |  
                    |                     ¦   «         |d|›d|›d|                     ¦   «         ›�¦  «         |                     ¦   «          Œs|                     d¦  «         dS )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}.
        zFor z, expected z	 but got N)r   ÚPostfixTCPMapDictServerFactoryr   r   ÚPostfixTCPMapServerÚserviceÚfactoryÚmakeConnectionr    ÚlineReceivedr   ÚvalueÚclearÚ
setTimeout©r   r%   Ú	transportÚprotocolÚinputÚexpected_outputs         r   Ú	test_chatz%PostfixTCPMapServerTestCase.test_chat4   s÷   € õ Ô8¸¼ÑCÔCˆÝ#Ñ%Ô%ˆ	åÔ.Ñ0Ô0ˆØ"ˆÔØ"ˆÔØ×Ò 	Ñ*Ô*Ð*à&*¤ið 	ð 	Ñ"ˆE�?Ø×!Ò! %Ñ(Ô(Ð(Ø×ÒØ—’Ñ!Ô!Ø�à�5�5˜/˜/˜/¨9¯?ª?Ñ+<Ô+<Ð+<ð>ñô ð ð �OŠOÑÔÐÐØ×Ò˜DÑ!Ô!Ð!Ð!Ð!r   c                 óö  — t          j        | j        ¦  «        }t          ¦   «         }t          j        ¦   «         }||_        ||_        |                     |¦  «         | j        D ]~\  }}| 	                    |¦  «         |  
                    |                     ¦   «         |d                     |||                     ¦   «         ¦  «        ¦  «         |                     ¦   «          Œ|                     d¦  «         dS )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   Ú'PostfixTCPMapDeferringDictServerFactoryr   r   r#   r$   r%   r&   r    r'   r   r(   Úformatr)   r*   r+   s         r   Útest_deferredChatz-PostfixTCPMapServerTestCase.test_deferredChatM   sø   € õ ÔAÀ$Ä)ÑLÔLˆÝ#Ñ%Ô%ˆ	åÔ.Ñ0Ô0ˆØ"ˆÔØ"ˆÔØ×Ò 	Ñ*Ô*Ð*à&*¤ið 		ð 		Ñ"ˆE�?Ø×!Ò! %Ñ(Ô(Ð(Ø×ÒØ—’Ñ!Ô!ØØ6×=Ò=Ø˜?¨I¯OªOÑ,=Ô,=ñô ñô ð ð �OŠOÑÔÐÐØ×Ò˜DÑ!Ô!Ð!Ð!Ð!r   c                 ó  —  G d„ d¦  «        }t          j        ¦   «         } |¦   «         |_        t          ¦   «         |_        |                     d¦  «         |                      |j                             ¦   «         d¦  «         dS )z^
        If the factory throws an exception,
        error code 400 must be returned.
        c                   ó   — e Zd ZdZd„ ZdS )úCPostfixTCPMapServerTestCase.test_getException.<locals>.ErrorFactoryzE
            Factory that raises an error on key lookup.
            c                 ó    — t          d¦  «        ‚)NzThis is a test error)Ú	Exception)r   Úkeys     r   ÚgetzGPostfixTCPMapServerTestCase.test_getException.<locals>.ErrorFactory.getr   s   € ÝÐ 6Ñ7Ô7Ð7r   N)r   r   r   Ú__doc__r;   r   r   r   ÚErrorFactoryr7   m   s-   € € € € € ðð ð8ð 8ð 8ð 8ð 8r   r=   s   get examples   400 This is a test error
N)r   r#   r%   r   r,   r'   r   r(   )r   r=   Úservers      r   Útest_getExceptionz-PostfixTCPMapServerTestCase.test_getExceptiong   s•   € ð	8ð 	8ð 	8ð 	8ð 	8ñ 	8ô 	8ð 	8õ Ô,Ñ.Ô.ˆØ%˜™œˆŒÝ*Ñ,Ô,ˆÔØ×Ò˜NÑ+Ô+Ð+Ø×Ò˜Ô)×/Ò/Ñ1Ô1Ð3PÑQÔQÐQÐQÐQr   N)r   r   r   r   r   ÚbytesÚ__annotations__r    r   r   r0   r4   r?   r   r   r   r   r   +   s�   € € € € € € ð €Dˆ$ˆu�eˆ|Ô
ð ð ñ ð'€Dˆ$ˆu�U˜E�\Ô"Ô
#ð ð ñ ð"ð "ð "ð2"ð "ð "ð4Rð Rð Rð Rð Rr   r   c                   ó    — e Zd ZdddœZg d¢ZdS )Ú
ValidTestss
   ThisIs Foos    bar really is found
)r   s   bar)
)s   gets&   400 Command 'get' takes 1 parameters.
)s   get foo baró   500 
)s   putó&   400 Command 'put' takes 2 parameters.
)s   put foorE   )s   put foo bar bazó    500 put is not implemented yet.
)s   put foo barrF   )s   get foos   200 ThisIs%20Foo
)s   get bars'   200 %20bar%20really%20is%20found%0D%0A
)s   get bazrD   )r   s   400 unknown command
N)r   r   r   r   r    r   r   r   rC   rC   |   s1   € € € € € àØ+ðð €Dðð ð €D€D€Dr   rC   N)r<   Útypingr   r   r   Útwisted.internet.testingr   Útwisted.protocolsr   Útwisted.trialr   ÚTestCaser
   r   rC   r   r   r   ú<module>rL      s  ððð ð %Ð $Ð $Ð $Ð $Ð $Ð $Ð $Ð $Ð $à 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø %Ð %Ð %Ð %Ð %Ð %Ø "Ð "Ð "Ð "Ð "Ð "ð:ð :ð :ð :ð :˜hÔ/ñ :ô :ð :ð8NRð NRð NRð NRð NRñ NRô NRð NRðbð ð ð ð Ð,¨hÔ.?ñ ô ð ð ð r   