ó
    ×›‘hI  ã                   óª   • S r SSKJrJrJr  SSKJr  SSKJr  SSK	J
r
   " S S\
R                  5      r " S S	5      r " S
 S\\
R                  5      rg)z2
Test cases for twisted.protocols.postfix module.
é    )ÚDictÚListÚTuple)ÚStringTransport)Úpostfix)Úunittestc                   ó"   • \ rS rSr/ SQrS rSrg)Ú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                 óî   • U R                    He  nUS   nUSS  nU R                  [        R                  " U5      US   5        U H)  nU R                  [        R                  " U5      U5        M+     Mg     g )Nr   é   )ÚdataÚassertEqualr   ÚquoteÚunquote)ÚselfÚentryÚrawÚquotedÚqs        Ú]C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/test/test_postfix.pyÚtestDataÚ PostfixTCPMapQuoteTests.testData!   sd   € Ø—Y”YˆEØ˜‘(ˆCØ˜1˜2�YˆFà×ÑœWŸ]š]¨3Ó/°¸±Ô;Û�Ø× Ñ ¤§¢°Ó!3°SÖ9ó ò ó    © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r   Ú__static_attributes__r   r   r   r
   r
      s   † ò€Dõ":r   r
   c                   ó^   • \ rS rSr% 0 r\\\4   \S'   / r\	\
\\4      \S'   S rS rS rSrg)	ÚPostfixTCPMapServerTestCaseé+   r   Úchatc                 óÀ  • [         R                  " U R                  5      n[        5       n[         R                  " 5       nXl        Xl        UR                  U5        U R                   Ha  u  pEUR                  U5        U R                  UR                  5       USU< SU< SUR                  5       < 35        UR                  5         Mc     UR                  S5        g)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_chatÚ%PostfixTCPMapServerTestCase.test_chat4   s±   € ô ×8Ò8¸¿¹ÓCˆÜ#Ó%ˆ	ä×.Ò.Ó0ˆØ"ÔØ"ÔØ×Ñ 	Ô*à&*§i¤iÑ"ˆEØ×!Ñ! %Ô(Ø×ÑØ—‘Ó!Ùã›/¨9¯?©?Õ+<ð>ôð �O‰OÖñ '0ð 	×Ñ˜DÕ!r   c                 óÈ  • [         R                  " U R                  5      n[        5       n[         R                  " 5       nXl        Xl        UR                  U5        U R                   He  u  pEUR                  U5        U R                  UR                  5       USR                  XEUR                  5       5      5        UR                  5         Mg     UR                  S5        g)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/   r0   s         r   Útest_deferredChatÚ-PostfixTCPMapServerTestCase.test_deferredChatM   s¸   € ô ×AÒAÀ$Ç)Á)ÓLˆÜ#Ó%ˆ	ä×.Ò.Ó0ˆØ"ÔØ"ÔØ×Ñ 	Ô*à&*§i¤iÑ"ˆEØ×!Ñ! %Ô(Ø×ÑØ—‘Ó!ØØ6×=Ñ=Ø¨I¯O©OÓ,=óôð �O‰OÖñ '0ð 	×Ñ˜DÕ!r   c                 óî   •  " S S5      n[         R                  " 5       nU" 5       Ul        [        5       Ul        UR                  S5        U R                  UR                  R                  5       S5        g)zF
If the factory throws an exception,
error code 400 must be returned.
c                   ó   • \ rS rSrSrS rSrg)ÚCPostfixTCPMapServerTestCase.test_getException.<locals>.ErrorFactoryém   z-
Factory that raises an error on key lookup.
c                 ó   • [        S5      e)NzThis is a test error)Ú	Exception)r   Úkeys     r   ÚgetÚGPostfixTCPMapServerTestCase.test_getException.<locals>.ErrorFactory.getr   s   € ÜÐ 6Ó7Ð7r   r   N)r   r   r   r    Ú__doc__rC   r!   r   r   r   ÚErrorFactoryr>   m   s   † ñõ8r   rF   s   get examples   400 This is a test error
N)r   r(   r*   r   r1   r,   r   r-   )r   rF   Úservers      r   Útest_getExceptionÚ-PostfixTCPMapServerTestCase.test_getExceptiong   s^   € ÷	8ñ 	8ô ×,Ò,Ó.ˆÙ%›ˆŒÜ*Ó,ˆÔØ×Ñ˜NÔ+Ø×Ñ˜×)Ñ)×/Ñ/Ó1Ð3PÕQr   r   N)r   r   r   r    r   r   ÚbytesÚ__annotations__r%   r   r   r5   r:   rH   r!   r   r   r   r#   r#   +   sE   ‡ ð €Dˆ$ˆu�eˆ|Ñ
ó ð'€Dˆ$ˆu�U˜E�\Ñ"Ñ
#ó ò"ò2"õ4Rr   r#   c                   ó&   • \ rS rSrSSS.r/ SQrSrg)Ú
ValidTestsé|   s
   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 foorP   )s   put foo bar bazó    500 put is not implemented yet.
)s   put foo barrQ   )s   get foos   200 ThisIs%20Foo
)s   get bars'   200 %20bar%20really%20is%20found%0D%0A
)s   get bazrO   )r   s   400 unknown command
r   N)r   r   r   r    r   r%   r!   r   r   r   rM   rM   |   s   † àØ+ñ€DòƒDr   rM   N)rE   Útypingr   r   r   Útwisted.internet.testingr   Útwisted.protocolsr   Útwisted.trialr   ÚTestCaser
   r#   rM   r   r   r   Ú<module>rW      sQ   ðñ÷ %Ñ $å 4Ý %Ý "ô:˜h×/Ñ/ô :÷8NRñ NRôbÐ,¨h×.?Ñ.?õ r   