%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/twisted/mail/test/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/twisted/mail/test/__pycache__/test_pop3client.cpython-312.pyc

�

Ϫ�f�T���ddlZddlZddlmZddlmZddlmZddlZ	ddl
mZmZm
Z
mZmZddlmZddlmZmZmZddlmZdd	lmZmZdd
lmZddlmZ	ddl m!Z!m"Z"Gd
�de�Z$ddddddd�Z%d-d�Z&d�Z'Gd�de�Z(Gd�d�Z)Gd�d�Z*Gd�de�Z+Gd�de�Z,Gd�de�Z-Gd �d!e�Z.Gd"�d#�Z/Gd$�d%ej`�Z1ee!d&�ee
jded�d&�Gd'�d(e���Z3Gd)�d*e/e�Z4Gd+�d,e�Z5y#e#$rdZ!dZ"Y��wxYw).�N)�List)�skipIf)�directlyProvides)�defer�error�
interfaces�protocol�reactor)�StringTransport)�AdvancedPOP3Client� InsecureAuthenticationDisallowed�ServerErrorResponse)�pop3testserver)�basic�loopback)�log)�TestCase)�ClientTLSContext�ServerTLSContextc��eZdZd�Zy)�#StringTransportWithConnectionLosingc�^�|jjtj��y�N)r	�connectionLostr�ConnectionDone��selfs �C/usr/lib/python3/dist-packages/twisted/mail/test/test_pop3client.py�loseConnectionz2StringTransportWithConnectionLosing.loseConnection!s���
�
�$�$�U�%9�%9�%;�<�N)�__name__�
__module__�__qualname__r�r rrr s��=r rs180sLOGIN)sTOPsLOGIN-DELAYsUIDL�STLSsUSERsSASLc��t�}t|_t�}||_|j|�|r|j
d�||fS)Ns+OK Hello!
)�
POP3Client�capCache�	_capCacherr	�makeConnection�dataReceived)�greet�p�ts   r�setUpr//sH����A��A�K�+�-�A��A�J����Q���	���(�)��a�4�Kr c��|fd�S)Nc��|�Srr$)�result�fs  r�<lambda>zstrip.<locals>.<lambda>As��q�s�r r$)r3s r�stripr5@s���"�"r c�Z�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zy)�POP3ClientLoginTestsc����td��\}}d|_|jdd�}|jd��j	|t
�j
�fd��S)NF�r,T�username�passwords-ERR Offline for maintenance
c�B���j|jdd�S)NrsOffline for maintenance��assertEqual�args��excrs �rr4z;POP3ClientLoginTests.testNegativeGreeting.<locals>.<lambda>Ks����(�(����!��6P�Q�r )r/�allowInsecureLogin�loginr+�
assertFailurer�addCallback�rr-r.�ds`   r�testNegativeGreetingz)POP3ClientLoginTests.testNegativeGreetingEsZ����5�!���1�#���
�G�G�K��-��	���:�;��!�!�!�%8�9�E�E�Q�
�	
r c���t�\}}|jd�}|j|j�d�|j	d�|j|jd�S)Nr:�USER username
s+OK send password
s
send password)r/�userr>�valuer+rErFs    r�
testOkUserzPOP3ClientLoginTests.testOkUserNsW���w���1�
�F�F�;����������$8�9�	���/�0��}�}�T�-�-�/?�@�@r c����t�\}}|jd�}�j|j�d�|j	d��j|t�j�fd��S)Nr:rJs-ERR account suspended
c�B���j|jdd�S)Nrsaccount suspendedr=r@s �rr4z2POP3ClientLoginTests.testBadUser.<locals>.<lambda>[s����(�(����!��6J�K�r )r/rKr>rLr+rDrrErFs`   r�testBadUserz POP3ClientLoginTests.testBadUserUsd����w���1�
�F�F�;����������$8�9�	���4�5��!�!�!�%8�9�E�E�K�
�	
r c���t�\}}|jd�}|j|j�d�|j	d�|j|jd�S)Nr;�PASS password
s+OK you're in!
s
you're in!)r/�passwordr>rLr+rErFs    r�
testOkPasszPOP3ClientLoginTests.testOkPass^sV���w���1�
�J�J�{�#���������$8�9�	���,�-��}�}�T�-�-�}�=�=r c����t�\}}|jd�}�j|j�d�|j	d��j|t�j�fd��S)Nr;rRs-ERR go away
c�B���j|jdd�S)Nrsgo awayr=r@s �rr4z2POP3ClientLoginTests.testBadPass.<locals>.<lambda>ks����(�(����!��j�A�r )r/rSr>rLr+rDrrErFs`   r�testBadPassz POP3ClientLoginTests.testBadPassesd����w���1�
�J�J�{�#���������$8�9�	���*�+��!�!�!�%8�9�E�E�A�
�	
r c�J�t�\}}d|_|jdd�}|j|j	�d�|jd�|j|j	�d�|jd�|j
|jd�S)	NTr:r;rJs+OK go ahead
�USER username
PASS password
s+OK password accepted
spassword accepted)r/rBrCr>rLr+rErFs    r�testOkLoginz POP3ClientLoginTests.testOkLoginns����w���1�#���
�G�G�K��-���������$8�9�	���*�+��������$I�J�	���3�4��}�}�T�-�-�/C�D�Dr c�d��t�\}}d|_|jdd�}�j|j	�d�|jd��j|j	�d�|jd��j
|t�j�fd��S)	NTr:r;rJs+OK waiting on you
rY�-ERR bogus login
c�B���j|jdd�S�Nrsbogus loginr=r@s �rr4z;POP3ClientLoginTests.testBadPasswordLogin.<locals>.<lambda>������(�(����!��n�E�r �	r/rBrCr>rLr+rDrrErFs`   r�testBadPasswordLoginz)POP3ClientLoginTests.testBadPasswordLoginxs�����w���1�#���
�G�G�K��-���������$8�9�	���0�1��������$I�J�	���.�/��!�!�!�%8�9�E�E�E�
�	
r c���t�\}}d|_|jdd�}�j|j	�d�|jd��j
|t�j�fd��S)NTr:r;rJr\c�B���j|jdd�Sr^r=r@s �rr4z;POP3ClientLoginTests.testBadUsernameLogin.<locals>.<lambda>�r_r r`rFs`   r�testBadUsernameLoginz)POP3ClientLoginTests.testBadUsernameLogin�sn����w���1�#���
�G�G�K��-���������$8�9�	���.�/��!�!�!�%8�9�E�E�E�
�	
r c�|�td��\}}|jd�|j|jd�y)NFr9s"+OK lalala this has no challenge
�r/r+r>�serverChallenge�rr-r.s   r�testServerGreetingz'POP3ClientLoginTests.testServerGreeting�s3���5�!���1�	���>�?�����*�*�D�1r c�|�td��\}}|jd�|j|jd�y)NFr9s+OK <here is the challenge>
s<here is the challenge>rfrhs   r�testServerGreetingWithChallengez4POP3ClientLoginTests.testServerGreetingWithChallenge�s4���5�!���1�	���9�:�����*�*�,F�Gr c��td��\}}|jd�|jdd�}|j|j	�d�|jd�|j|jd�S)	NFr9s"+OK <challenge string goes here>
r:r;s0APOP username f34f1e464d0d7927607753129cabe39a
s+OK Welcome!
sWelcome!)r/r+rCr>rLrErFs    r�testAPOPzPOP3ClientLoginTests.testAPOP�sm���5�!���1�	���>�?�
�G�G�K��-�����
�G�G�I�L�	
�	
���*�+��}�}�T�-�-�{�;�;r c���td��\}}|jd�|jdd�}|j|j	��|j|t�S)NFr9�+OK Howdy
r:r;)r/r+rC�assertFalserLrDr
rFs    r� testInsecureLoginRaisesExceptionz5POP3ClientLoginTests.testInsecureLoginRaisesException�sU���5�!���1�	���'�(�
�G�G�K��-���������#��!�!�!�%E�F�Fr c��td��\}}t|tj�|j	d�|jdd�}|j
|j�d�|j�|j	d�|j
|j�d�|j	d�|S)	z�
        If a server doesn't offer APOP but the transport is secured using
        SSL or TLS, a plaintext login should be allowed, not rejected with
        an InsecureAuthenticationDisallowed exception.
        Fr9ror:r;rJs+OK
rR)	r/rr�
ISSLTransportr+rCr>rL�clearrFs    r� testSSLTransportConsideredSecurez5POP3ClientLoginTests.testSSLTransportConsideredSecure�s����5�!���1���J�4�4�5�	���'�(�
�G�G�K��-���������$8�9�	���	�	���z�"��������$8�9�	���z�"��r N)r!r"r#rHrMrPrTrWrZrardrirkrmrqrur$r rr7r7DsG��
�A�
�>�
�E�

�
�2�
H�
<�G�r r7c��eZdZd�Zd�Zy)�ListConsumerc��i|_yr��datars r�__init__zListConsumer.__init__��	����	r c�d�|\}}|jj|g�j|�yr)rz�
setdefault�append)rr2�itemrLs    r�consumezListConsumer.consume�s*���
��u��	�	���T�2�&�-�-�e�4r N�r!r"r#r{r�r$r rrwrw�s���5r rwc��eZdZd�Zd�Zy)�MessageConsumerc��g|_yrryrs rr{zMessageConsumer.__init__�r|r c�:�|jj|�yr)rzr�r�lines  rr�zMessageConsumer.consume�s���	�	����r Nr�r$r rr�r��s���r r�c�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�POP3ClientListTestsc��t�\}}|j�}|j|j�d�|j	d�|j	d�|j|jgd��S)N�LIST
�+OK Here it comes
s1 3
2 2
3 1
.
)���)r/�listSizer>rLr+rErFs    r�testListSizez POP3ClientListTests.testListSize�s_���w���1�
�J�J�L���������K�0�	���/�0�	���4�5��}�}�T�-�-�y�9�9r c
��t�\}}t�}|j}|j|�}|j	|j�d�|j
d�|j
d�|j	|jdgdgdgd��|j
d�|j	|jdgdgdgdgdgdgd	��|j
d
�|j|j|�S)Nr�r�s1 3
2 2
3 1
r�r�r�)rr�r�s5 3
6 2
7 1
)rr�r�����.
)
r/rwr�r�r>rLr+rzrE�assertIdentical�rr-r.�cr3rGs      r�testListSizeWithConsumerz,POP3ClientListTests.testListSizeWithConsumer�s����w���1��N��
�I�I��
�J�J�q�M���������K�0�	���/�0�	���/�0�������a�S�a�S�a�S�!9�:�	���/�0�������a�S�a�S�a�S�a�S�a�S�a�S�!Q�R�	���x� ��}�}�T�1�1�1�5�5r c����t�\}}|j�}�j|j�d�|j	d��j|t�j�fd��S)Nr��!-ERR Fatal doom server exploded
c�B���j|jdd�S�NrsFatal doom server explodedr=r@s �rr4z8POP3ClientListTests.testFailedListSize.<locals>.<lambda>������(�(����!��6S�T�r )r/r�r>rLr+rDrrErFs`   r�testFailedListSizez&POP3ClientListTests.testFailedListSize�s`����w���1�
�J�J�L���������K�0�	���=�>��!�!�!�%8�9�E�E�T�
�	
r c��t�\}}|j�}|j|j�d�|j	d�|j	d�|j|jgd��S)N�UIDL
r�s1 abc
2 def
3 ghi
.
)�abcsdefsghi)r/�listUIDr>rLr+rErFs    r�testListUIDzPOP3ClientListTests.testListUID�s`���w���1�
�I�I�K���������K�0�	���/�0�	���:�;��}�}�T�-�-�/G�H�Hr c��t�\}}t�}|j}|j|�}|j	|j�d�|j
d�|j
d�|j	|jdgdgdgd��|j
d�|j|j|�S)	Nr�r�s1 xyz
2 abc
5 mno
sxyzr�smno)rr�r�r�)
r/rwr�r�r>rLr+rzrEr�r�s      r�testListUIDWithConsumerz+POP3ClientListTests.testListUIDWithConsumer�s����w���1��N��
�I�I��
�I�I�a�L���������K�0�	���/�0�	���5�6�������f�X�6�(��x�!H�I�	���x� ��}�}�T�1�1�1�5�5r c����t�\}}|j�}�j|j�d�|j	d��j|t�j�fd��S)Nr�r�c�B���j|jdd�Sr�r=r@s �rr4z7POP3ClientListTests.testFailedListUID.<locals>.<lambda>r�r )r/r�r>rLr+rDrrErFs`   r�testFailedListUIDz%POP3ClientListTests.testFailedListUIDs`����w���1�
�I�I�K���������K�0�	���=�>��!�!�!�%8�9�E�E�T�
�	
r N)	r!r"r#r�r�r�r�r�r�r$r rr�r��s!��:�6�
�I�
6�
r r�c�<�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�POP3ClientMessageTestsc�B�t�\}}|jd�}|j|j�d�|j	d�|j	d�|j	d�|j	d�|j|jddg�S)	N��RETR 8
�+OK Message incoming
�La la la here is message text
s"..Further message text tra la la
r��La la la here is message texts.Further message text tra la la�r/�retriever>rLr+rErFs    r�testRetrievez#POP3ClientMessageTests.testRetrieves����w���1�
�J�J�q�M���������M�2�	���2�3�	���;�<�	���>�?�	���x� ��}�}����
-�/Q�R�
�	
r c�L�t�\}}t�}|j}|jd|�}|j	|j�d�|j
d�|j
d�|j
d�|j|j||�S)Nr�r�r�r�s..Further message text
.
)	r/r�r�r�r>rLr+rE�_cbTestRetrieveWithConsumerr�s      r�testRetrieveWithConsumerz/POP3ClientMessageTests.testRetrieveWithConsumers����w���1����
�I�I��
�J�J�q�!����������M�2�	���2�3�	���;�<�	���9�:��}�}�T�=�=�q�!�D�Dr c�d�|j||�|j|jddg�y)Nr�s.Further message text�r�r>rz�rr2r3r�s    rr�z2POP3ClientMessageTests._cbTestRetrieveWithConsumer#s0�����V�Q�'����
�F�F�5�7O�P�	
r c�F�t�\}}|jdd��}|j|j�d�|j	d�|j	d�|j	d�|j	d�|j|jd	d
g�S)Nr�r���lines�	TOP 8 2
�+OK 2 lines on the way
�Line the first!  Woop
�Line the last!  Bye
r��Line the first!  Woop�Line the last!  Byer�rFs    r�testPartialRetrievez*POP3ClientMessageTests.testPartialRetrieve)s����w���1�
�J�J�q��J�"���������N�3�	���4�5�	���3�4�	���1�2�	���x� ��}�}����7�9O�P�
�	
r c�r�t�\}}t�}|j}|jd|d��}|j	|j�d�|j
d�|j
d�|j
d�|j
d�|j|j||�S)	Nr�r�r�r�r�r�r�r�)	r/r�r�r�r>rLr+rE�"_cbTestPartialRetrieveWithConsumerr�s      r�testPartialRetrieveWithConsumerz6POP3ClientMessageTests.testPartialRetrieveWithConsumer5s����w���1����
�I�I��
�J�J�q�!�1�J�%���������N�3�	���4�5�	���3�4�	���1�2�	���x� ��}�}�T�D�D�a��K�Kr c�d�|j||�|j|jddg�y)Nr�r�r�r�s    rr�z9POP3ClientMessageTests._cbTestPartialRetrieveWithConsumerAs-�����V�Q�'�������":�<R�!S�Tr c����t�\}}|jd�}�j|j�d�|j	d��j|t�j�fd��S)NrsRETR 1
r�c�B���j|jdd�Sr�r=r@s �rr4z;POP3ClientMessageTests.testFailedRetrieve.<locals>.<lambda>Kr�r )r/r�r>rLr+rDrrErFs`   r�testFailedRetrievez)POP3ClientMessageTests.testFailedRetrieveEsb����w���1�
�J�J�q�M���������M�2�	���=�>��!�!�!�%8�9�E�E�T�
�	
r c
�X�t�\}}td�D�cgc]=}|j|�j|jd|dzfzd|dzfzg���?}}tdd�D]�}|j	|j�d|fz�|j
�|jd�|jd|fz�|jd	|fz�|j	|j�d
�|jd���tj|d�
�Scc}w)z�
        Issue three retrieve calls immediately without waiting for any to
        succeed and make sure they all do succeed eventually.
        r�sFirst line of %d.r�sSecond line of %d.r�s	RETR %d
r�sFirst line of %d.
sSecond line of %d.
r r�T)�fireOnOneErrback)
r/�ranger�rEr>rLrtr+r�DeferredList)rr-r.�i�messagess     r�test_concurrentRetrievesz/POP3ClientMessageTests.test_concurrentRetrievesNs��
�w���1��1�X�
�
�	
�J�J�q�M�%�%�� � �%��Q���0�2G�1�q�5�(�2R�S�
�
��
��q�!��	%�A����Q�W�W�Y��!��(=�>�
�G�G�I�
�N�N�8�9�
�N�N�3�q�d�:�;�
�N�N�4��t�;�<����Q�W�W�Y��,�
�N�N�8�$�	%��!�!�(�T�B�B��#
s�AD'N)r!r"r#r�r�r�r�r�r�r�r�r$r rr�r�
s.��
�	E�
�

�
L�U�
�Cr r�c�H�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)�POP3ClientMiscTestsc
��t�\}}|jd��}|j|j�d�|j	d�|j	d�|j|jdddgd�ddgdgd	��S)
Nr��useCache�CAPA
s+OK Capabilities on the way
s!X
Y
Z
A 1 2 3
B 1 2
C 1
.
)�1�2�3r�r�)�X�Y�Z�A�B�C�r/�capabilitiesr>rLr+rErFs    r�testCapabilityz"POP3ClientMiscTests.testCapabilityis����w���1�
�N�N�A�N�&���������K�0�	���9�:�	���I�J��}�}�������(��T�l��f�

�

�
	
r c���t�\}}|jd��}|j|j�d�|j	d�|j|ji�S)Nrr�r��-ERR This server is lame!
r�rFs    r�testCapabilityErrorz'POP3ClientMiscTests.testCapabilityError{sW���w���1�
�N�N�A�N�&���������K�0�	���7�8��}�}�T�-�-�r�2�2r c���t�\}}|j�}|j|j�d�|j	d�|j|jd�S)N�STAT
s+OK 1 1212
)r�i�)r/�statr>rLr+rErFs    r�testStatzPOP3ClientMiscTests.testStat�sR���w���1�
�F�F�H���������K�0�	���(�)��}�}�T�-�-�y�9�9r c����t�\}}|j�}�j|j�d�|j	d��j|t�j�fd��S)Nr�r�c�B���j|jdd�S�NrsThis server is lame!r=r@s �rr4z3POP3ClientMiscTests.testStatError.<locals>.<lambda>������(�(����!��6M�N�r )r/r�r>rLr+rDrrErFs`   r�
testStatErrorz!POP3ClientMiscTests.testStatError��`����w���1�
�F�F�H���������K�0�	���7�8��!�!�!�%8�9�E�E�N�
�	
r c���t�\}}|j�}|j|j�d�|j	d�|j|jd�S)N�NOOP
s+OK No-op to you too!
sNo-op to you too!)r/�noopr>rLr+rErFs    r�testNoopzPOP3ClientMiscTests.testNoop�sS���w���1�
�F�F�H���������K�0�	���3�4��}�}�T�-�-�/C�D�Dr c����t�\}}|j�}�j|j�d�|j	d��j|t�j�fd��S)Nr�r�c�B���j|jdd�Sr�r=r@s �rr4z3POP3ClientMiscTests.testNoopError.<locals>.<lambda>�r�r )r/r�r>rLr+rDrrErFs`   r�
testNoopErrorz!POP3ClientMiscTests.testNoopError�r�r c���t�\}}|j�}|j|j�d�|j	d�|j|jd�S)N�RSET
s+OK Reset state
sReset state)r/�resetr>rLr+rErFs    r�testRsetzPOP3ClientMiscTests.testRset�sR���w���1�
�G�G�I���������K�0�	���-�.��}�}�T�-�-�~�>�>r c����t�\}}|j�}�j|j�d�|j	d��j|t�j�fd��S)Nr�r�c�B���j|jdd�Sr�r=r@s �rr4z3POP3ClientMiscTests.testRsetError.<locals>.<lambda>�r�r )r/r�r>rLr+rDrrErFs`   r�
testRsetErrorz!POP3ClientMiscTests.testRsetError�s`����w���1�
�G�G�I���������K�0�	���7�8��!�!�!�%8�9�E�E�N�
�	
r c���t�\}}|jd�}|j|j�d�|j	d�|j|jd�S)Nr��DELE 4
s+OK Hasta la vista
sHasta la vista)r/�deleter>rLr+rErFs    r�
testDeletezPOP3ClientMiscTests.testDelete�sU���w���1�
�H�H�Q�K���������M�2�	���0�1��}�}�T�-�-�/@�A�Ar c����t�\}}|jd�}�j|j�d�|j	d��j|t�j�fd��S)Nr�rs-ERR Winner is not you.
c�B���j|jdd�S)NrsWinner is not you.r=r@s �rr4z5POP3ClientMiscTests.testDeleteError.<locals>.<lambda>�s����(�(����!��6K�L�r )r/rr>rLr+rDrrErFs`   r�testDeleteErrorz#POP3ClientMiscTests.testDeleteError�sb����w���1�
�H�H�Q�K���������M�2�	���5�6��!�!�!�%8�9�E�E�L�
�	
r N)
r!r"r#r�r�r�r�r�r�r�rrrr$r rr�r�hs6��
�$3�:�
�E�
�?�
�B�
r r�c��eZdZdd�Zd�Zy)�SimpleClientNc� �||_d|_y)NT)�deferredrB)rr�contextFactorys   rr{zSimpleClient.__init__�s�� ��
�"&��r c�:�|jjd�yr)r�callback)r�	challenges  r�serverGreetingzSimpleClient.serverGreeting�s���
�
���t�$r r)r!r"r#r{rr$r rr
r
�s��'�%r r
c�2�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	y)�POP3HelperMixinNc���tj�}tj|j��|_t
||j��|_d|j_	||_
y)N)r
�)r�Deferredr�POP3TestServer�	serverCTX�serverr
�	clientCTX�client�timeout�	connected)rrGs  rr/zPOP3HelperMixin.setUp�sI���N�N���$�3�3�4�>�>�R���"�1�T�^�^�D��� �������r c��|`|`|`yr)rrrrs r�tearDownzPOP3HelperMixin.tearDown�s���K��K��Nr c�L�|jjj�yr)r�	transportr)r�ignores  r�
_cbStopClientzPOP3HelperMixin._cbStopClient�s�������,�,�.r c��|jjj�|jjj�|Sr)rr!rr)r�failures  r�
_ebGeneralzPOP3HelperMixin._ebGeneral�s3�������,�,�.������,�,�.��r c�Z�tj|j|jd��S)NF)�noisy)r�loopbackTCPrrrs rrzPOP3HelperMixin.loopback�s���#�#�D�K�K����E�J�Jr )
r!r"r#rrr/rr#r&rr$r rrr�s&���I��I���
/��
Kr rc�6�eZdZGd�dej�Zy)�TLSServerFactoryc�2�eZdZUdZgZeeed<d�Zd�Z	y)�TLSServerFactory.protocolN�outputc��g|j_|jdd|_|jjd�D]}|j	|��y)Nr)�factory�inputr.�pop�sendLiner�s  r�connectionMadez(TLSServerFactory.protocol.connectionMade�sE��!#�D�L�L���+�+�a�.�D�K�������*�
$���
�
�d�#�
$r c��|jjj|�|jj	d�D�cgc]}|j|���c}|dk(r&|jj|j�yycc}w)Nrr%)	r0r1rr.r2r3r!�startTLS�context)rr��ls   r�lineReceivedz&TLSServerFactory.protocol.lineReceived�se���L�L���%�%�d�+�'+�{�{���q�'9�:�!�T�]�]�1�
�:��w�����'�'����5���
;s�B
)
r!r"r#r7r.r�bytes�__annotations__r4r9r$r rr	r-�s���� ���U�� �	$�	6r r	N)r!r"r#r�LineReceiverr	r$r rr+r+�s��6�5�%�%�6r r+zOpenSSL not presentc��eZdZdZd�Zy)�POP3TLSTestsz=
    Tests for POP3Client's support for TLS connections.
    c�n��
���
�t��
dggd�dgddgdgg�
j_t��
j_tjd�
d��}�j|j�|j�j}|j�j}tj��ttj�t�����fd�}|�_tj"�}�fd�|_tj$|||��
�fd	�}�fd
�}��
fd�}�
�fd�}	�j&j)|��j&j)|��j&j)|��j&j+|	��j&S)
zd
        POP3Client.startTLS starts a TLS session over its existing TCP
        connection.
        �+OK)r@r%�.rArz	127.0.0.1)�	interfacec�T��tj�|��jd�yr)r
rr)�reason�connLostDeferred�cps ��rrz2POP3TLSTests.test_startTLS.<locals>.connectionLosts!����'�'��F�3��%�%�d�+r c����Srr$)rFs�rr4z,POP3TLSTests.test_startTLS.<locals>.<lambda>s���b�r c�N��tjd��j�S)Nz!Connected to server; starting TLS)r�msgr6��ignoredrFs �r�cbConnectedz/POP3TLSTests.test_startTLS.<locals>.cbConnected!s����G�G�7�8��;�;�=� r c�N��tjd��j�S)NzStarted TLS; disconnecting)rrI�quitrJs �r�cbStartedTLSz0POP3TLSTests.test_startTLS.<locals>.cbStartedTLS%s����G�G�0�1��7�7�9�r c�l��tjd��j�jgd��y)Nz.Disconnected; asserting correct input received)�CAPAr%rQsQUIT)rrIr>r1)�ignr�sfs ��r�cbDisconnectedz2POP3TLSTests.test_startTLS.<locals>.cbDisconnected)s%����G�G�D�E����R�X�X�'K�Lr c�R��tjd��j��S)NzEAsserted correct input; disconnecting client and shutting down server)rrI�
disconnect)r2�connrEs ��r�cleanupz+POP3TLSTests.test_startTLS.<locals>.cleanup-s&����G�G�2�
�
�O�O��#�#r )r+r	r.rr7r
�	listenTCP�
addCleanup�
stopListening�getHost�host�portrrr
rr�
ClientFactory�
connectTCPrrE�addBoth)rr^�H�Pr�cfrLrOrTrXrWrErFrSs`         @@@@r�
test_startTLSzPOP3TLSTests.test_startTLSsR���
�
��
�H�#�
�H�
�T�N�
�H�
�����/�0������ � ��B�+�>������*�*�+��L�L�N�����L�L�N���� �>�>�+��
�%�.�.�*�,<�,>�
?��	,�+���
�
#�
#�
%�� ����!�!�!�Q��+��	!�	�	M�	$�	������,�
������-�
������/�
�����G�$��{�{�r N)r!r"r#�__doc__rer$r rr>r>�s���9r r>c��eZdZd�Zy)�POP3TimeoutTestsc��������fd�}�fd���fd���fd�}d�j_dt_||g}t	�j
jt	t|���j
j
�j��j
j�j��j�S)Nc����jjdd�}|j��|j��|S)N�test�twisted)rrCrE�
addErrback)rG�loggedInr�timedOuts ���rrCz+POP3TimeoutTests.testTimeout.<locals>.login?s6������!�!�&�)�4�A�
�M�M�(�#�
�L�L��"��Hr c�(���jd�y)Nz%Successfully logged in!?  Impossible!)�fail)r2rs �rrnz.POP3TimeoutTests.testTimeout.<locals>.loggedInEs����I�I�=�>r c�f��|jtj��jd�yr)�trapr�TimeoutErrorr#)r%rs �rroz.POP3TimeoutTests.testTimeout.<locals>.timedOutHs#����L�L��+�+�,����t�$r c�8���jj�Sr)rrNrs�rrNz*POP3TimeoutTests.testTimeout.<locals>.quitLs����;�;�#�#�%�%r g{�G�z�?T)rrr�TIMEOUT_RESPONSE�maprrEr5r#rmr&r)rrCrN�methodsrnros`   @@r�testTimeoutzPOP3TimeoutTests.testTimeout>s����	�	?�	%�	&�#�����+/��'��$�-���D�N�N�&�&��E�7�(;�<����"�"�4�#5�#5�6����!�!�$�/�/�2��}�}��r N)r!r"r#ryr$r rrhrh=s��r rhc��eZdZdZd�Zd�Zy)�POP3ClientModuleStructureTestszt
    Miscellaneous tests more to do with module/package structure than
    anything to do with the POP3 client.
    c�l�|jtjjjg�y)z�
        twisted.mail._pop3client.__all__ should be empty because all classes
        should be imported through twisted.mail.pop3.
        N)r>rl�mail�_pop3client�__all__rs r�test_allz'POP3ClientModuleStructureTests.test_allbs$��
	
������1�1�9�9�2�>r c���tjtjdtj�D�cgc]}|dddk(s|d��}}|D]�}|dk(sR|jt
tjj|�|�dtjj����Z|jt
tjjd����ycc}w)a
        Every public class in twisted.mail._pop3client should be available as
        a member of twisted.mail.pop3 with the exception of
        twisted.mail._pop3client.POP3Client which should be available as
        twisted.mail.pop3.AdvancedClient.
        ztwisted.mail._pop3clientr�_r'z not in rN)
�inspect�
getmembers�sys�modules�isclass�
assertTrue�hasattrrlr}�pop3)rr��
publicClasses�pcs    r�test_importz*POP3ClientModuleStructureTests.test_importis����'�'����6�7�����
���Q�4��7�c�>�	
�a�D�
�
�
� �	R�B���%�����G�L�L�-�-�r�2��d�(�7�<�<�#4�#4�"5�6��
�������(9�(9�;O� P�Q�	R��
s�C#N)r!r"r#rfr�r�r$r rr{r{\s���
?�Rr r{)T)6r�r��typingr�unittestr�zope.interfacer�twisted.mail._pop3clientrl�twisted.internetrrrr	r
�twisted.internet.testingr�twisted.mail.pop3rr'r
r�twisted.mail.testr�twisted.protocolsrr�twisted.pythonr�twisted.trial.unittestr�twisted.test.ssl_helpersrr�ImportErrorrr(r/r5r7rwr�r�r�r�r
r�
ServerFactoryr+�IReactorSSLr>rhr{r$r r�<module>r�ss��
�
���+��H�H�4���
-�-��+��K�=�/�=�
��
�
�
�
�
���"#�t�8�t�n5�5���;
�(�;
�|[C�X�[C�|X
�(�X
�v%�:�%�K�K�86�x�-�-�6�$���3�4��"�J�"�"�7�D�1�1�3H�I�>�8�>�J�5�>�B����>#R�X�#R��C�������s�D3�3	D?�>D?

Zerion Mini Shell 1.0