Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_smtpd.cpython-311.pyc
�

�Keߢ��>�ddlZddlZddlmZmZddlmZddlmZddlZddl	Z	ej
d��Zej
d��Zej
sejd���Gd�d	ej��ZGd
�de��ZGd�d
e��ZGd�dej��ZGd�dej��ZGd�dej��ZGd�dej��ZGd�dej��ZGd�dej��Zejejd��Gd�de����ZGd�dej��ZGd�d ej��ZGd!�d"ej��Z Gd#�d$ej��Z!Gd%�d&ej��Z"e#d'krej$��dSdS)(�N)�support�mock_socket)�
socket_helper)�warnings_helper�smtpd�asyncoreztest requires gethostname()c��eZdZd�Zd�ZdS)�DummyServerc�v�tjj|g|�Ri|��g|_|jr	d|_dSd|_dS)Nz
return statuss
return status)r�
SMTPServer�__init__�messages�_decode_data�
return_status)�self�args�kwargss   �9/usr/local/apps/python3/lib/python3.11/test/test_smtpd.pyr
zDummyServer.__init__sT��
��!�$�8��8�8�8��8�8�8���
���	2�!0�D����!1�D����c��|j�||||f��||jkrdSd|vrd|dvrdSdSdS)Nz	250 Okish�mail_options�SMTPUTF8z250 SMTPUTF8 message okish)r�appendr)r�peer�mailfrom�rcpttos�data�kws      r�process_messagezDummyServer.process_messagesb���
���d�H�g�t�<�=�=�=��4�%�%�%��;��R���J�"�^�2D�$D�$D�/�/� ��$D�$DrN)�__name__�
__module__�__qualname__r
r�rrr
r
s2������2�2�2�0�0�0�0�0rr
c��eZdZdS)�DummyDispatcherBrokenN)r r!r"r#rrr%r%"s�������Drr%c��eZdZd�ZdS)�BrokenDummyServerc��t����N)r%)r�nums  r�listenzBrokenDummyServer.listen's��#�%�%�%rN)r r!r"r+r#rrr'r'&s#������&�&�&�&�&rr'c�&�eZdZd�Zd�Zd�Zd�ZdS)�SMTPDServerTestc�@�txt_t_dSr)�rr�socketr�rs r�setUpzSMTPDServerTest.setUp,���)4�4���x���rc�^��t�tjdfdd���}|���\}}t�|||d�����fd�}|d��|d��|d��|d	��|�t|d
��dS)Nr��brT��decode_datac�d���j�|������dSr)�r0�
queue_recv�handle_read��line�channels �r�
write_linezFSMTPDServerTest.test_process_message_unimplemented.<locals>.write_line5�1����N�%�%�d�+�+�+����!�!�!�!�!r�HELO example�MAIL From:eggs@example�RCPT To:spam@example�DATAs	spam
.
)rrr�HOST�accept�SMTPChannel�assertRaises�NotImplementedError)r�server�conn�addrr@r?s     @r�"test_process_message_unimplementedz2SMTPDServerTest.test_process_message_unimplemented/s�����!�!�=�#5�q�"9�8�.2�"�4�4���]�]�_�_�
��d��#�#�F�D�$�D�#�I�I��	"�	"�	"�	"�	"�	�
�?�#�#�#��
�,�-�-�-��
�*�+�+�+��
�7�������-�z�;K�L�L�L�L�Lrc�r�|�ttjtjdfddd���dS)Nrr5T��enable_SMTPUTF8r8)rI�
ValueErrorrrrrFr1s r�+test_decode_data_and_enable_SMTPUTF8_raisesz;SMTPDServerTest.test_decode_data_and_enable_SMTPUTF8_raises?sF��������
�
��#�� ��
	�	�	�	�	�	rc�r�t���txt_t_dSr)�r�	close_allr0rr1s r�tearDownzSMTPDServerTest.tearDownH�&��������)/�/���%�,�,�,rN)r r!r"r2rNrSrWr#rrr-r-+sS������5�5�5�M�M�M� ���0�0�0�0�0rr-c�:�eZdZd�Zd
d�Zd�Zd�Zd�Zd�Zd�Z	d	S)�DebuggingServerTestc�@�txt_t_dSr)r/r1s rr2zDebuggingServerTest.setUpOr3rFc����fd�}|d��|r|d��n|d��|d��|d��||��|d��dS)Nc�d���j�|������dSr)r:r=s �rr@z1DebuggingServerTest.send_data.<locals>.write_lineSrAr�EHLO examples-MAIL From:eggs@example BODY=8BITMIME SMTPUTF8rCrDrE�.r#)rr?rrQr@s `   r�	send_datazDebuggingServerTest.send_dataRs����	"�	"�	"�	"�	"�	�
�?�#�#�#��	2��J�G�H�H�H�H��J�0�1�1�1��
�*�+�+�+��
�7�����
�4�����
�4�����rc��t�tjdfdd���}|���\}}t�|||d���}t
j��5}|�|d��ddd��n#1swxYwY|�	��}|�
|tjd����dS)Nrr5Tr7sFrom: test

hello
z�             ---------- MESSAGE FOLLOWS ----------
             From: test
             X-Peer: peer-address

             hello
             ------------ END MESSAGE ------------
             �
r�DebuggingServerrrFrGrHr�captured_stdoutr`�getvalue�assertEqual�textwrap�dedent�rrKrLrMr?�s�stdouts       r�*test_process_message_with_decode_data_truez>DebuggingServerTest.test_process_message_with_decode_data_true`s���&�&�
�(:�A�'>��37�'�9�9���]�]�_�_�
��d��#�#�F�D�$�D�#�I�I��
�
$�
&�
&�	>�!��N�N�7�$<�=�=�=�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>����	>�	>�	>�	>�������������2�"�"�	�	�	�	�	��2B�B�Bc��t�tjdfd��}|���\}}t�|||��}t
j��5}|�|d��ddd��n#1swxYwY|�	��}|�
|tjd����dS)Nrr5�From: test

héllo�
��             ---------- MESSAGE FOLLOWS ----------
             b'From: test'
             b'X-Peer: peer-address'
             b''
             b'h\xc3\xa9llo\xff'
             ------------ END MESSAGE ------------
             rbris       r�+test_process_message_with_decode_data_falsez?DebuggingServerTest.test_process_message_with_decode_data_falseqs���&�&�
�(:�A�'>��I�I���]�]�_�_�
��d��#�#�F�D�$�7�7��
�
$�
&�
&�	I�!��N�N�7�$G�H�H�H�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I����	I�	I�	I�	I�������������2�"�"�	�	�	�	�	s�.B�B�Bc��t�tjdfdd���}|���\}}t�|||d���}t
j��5}|�|d��ddd��n#1swxYwY|�	��}|�
|tjd����dS)Nrr5T�rQrorprbris       r�.test_process_message_with_enable_SMTPUTF8_truezBDebuggingServerTest.test_process_message_with_enable_SMTPUTF8_true�s"���&�&�
�(:�A�'>��7;�'�=�=���]�]�_�_�
��d��#�#�F�D�$��#�M�M��
�
$�
&�
&�	I�!��N�N�7�$G�H�H�H�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I����	I�	I�	I�	I�������������2�"�"�	�	�	�	�	rmc��t�tjdfdd���}|���\}}t�|||d���}t
j��5}|�|dd���ddd��n#1swxYwY|�	��}|�
|tjd����dS)Nrr5Trsroa             ---------- MESSAGE FOLLOWS ----------
             mail options: ['BODY=8BITMIME', 'SMTPUTF8']
             b'From: test'
             b'X-Peer: peer-address'
             b''
             b'h\xc3\xa9llo\xff'
             ------------ END MESSAGE ------------
             rbris       r�7test_process_SMTPUTF8_message_with_enable_SMTPUTF8_truezKDebuggingServerTest.test_process_SMTPUTF8_message_with_enable_SMTPUTF8_true�s"���&�&�
�(:�A�'>��7;�'�=�=���]�]�_�_�
��d��#�#�F�D�$��#�M�M��
�
$�
&�
&�	1�!��N�N�7�$G�+/�
�
1�
1�
1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1����	1�	1�	1�	1�������������2�"�"�	�	�	�	�	s�2B�B�Bc�r�t���txt_t_dSr)rUr1s rrWzDebuggingServerTest.tearDown�rXrN)F)
r r!r"r2r`rlrqrtrvrWr#rrrZrZMs�������5�5�5��������"��� ���"���&0�0�0�0�0rrZc�^�eZdZd�Zd�Zejejd��d���Z	d�Z
dS)�TestFamilyDetectionc�@�txt_t_dSr)r/r1s rr2zTestFamilyDetection.setUp�r3rc�r�t���txt_t_dSr)rUr1s rrWzTestFamilyDetection.tearDown�rXr�IPv6 not enabledc��t�tjdftjdf��}|�|jjtj��dS�Nr)	rrr�HOSTv6�HOSTv4rfr0�family�AF_INET6�rrKs  r�test_socket_uses_IPv6z)TestFamilyDetection.test_socket_uses_IPv6�sK���!�!�=�#7��";�m�>R�TU�=V�W�W�������-�v��?�?�?�?�?rc��t�tjdftjdf��}|�|jjtj��dSr~)	rrrr�rrfr0r��AF_INETr�s  r�test_socket_uses_IPv4z)TestFamilyDetection.test_socket_uses_IPv4�sK���!�!�=�#7��";�m�>R�TU�=V�W�W�������-�v�~�>�>�>�>�>rN)r r!r"r2rW�unittest�
skipUnlessr�IPV6_ENABLEDr�r�r#rrryry�st������5�5�5�0�0�0��X���3�5G�H�H�@�@�I�H�@�?�?�?�?�?rryc�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)�TestRcptOptionParsing�:555 RCPT TO parameters not recognized or not implemented
c��txt_t_tj|_t
j��x|_t_dSr)�	rrr0r�DEBUGSTREAM�old_debugstream�io�StringIO�debugr1s rr2zTestRcptOptionParsing.setUp��6��)4�4���x��$�0���)+����6��
�U�&�&�&rc��t���txt_t_|jt_dSr)�rrVr0rr�r�r1s rrWzTestRcptOptionParsing.tearDown��3��������)/�/���%�,� �0����rc�b�|j�|��|���dSr)r:�rr?r>s   rr@z TestRcptOptionParsing.write_line��0����!�!�$�'�'�'��������rc�r�ttjdfd��}|���\}}t�|||��}|�|d��|�|d��|�|d��|�|jj	|j
��dS)Nrr5r^�$MAIL from: <foo@example.com> size=20s"RCPT to: <foo@example.com> foo=bar�r
rrFrGrrHr@rfr0�last�error_response�rrKrLrMr?s     r�test_params_rejectedz*TestRcptOptionParsing.test_params_rejected�s����m�0�!�4�h�?�?���]�]�_�_�
��d��#�#�F�D�$�7�7�������1�1�1�����!H�I�I�I�����!F�G�G�G������,�d�.A�B�B�B�B�Brc�h�ttjdfd��}|���\}}t�|||��}|�|d��|�|d��|�|d��|�|jj	d��dS)Nrr5r^r�sRCPT to: <foo@example.com>�250 OK
�
r
rrFrGrrHr@rfr0r�r�s     r�test_nothing_acceptedz+TestRcptOptionParsing.test_nothing_accepted�s����m�0�!�4�h�?�?���]�]�_�_�
��d��#�#�F�D�$�7�7�������1�1�1�����!H�I�I�I�����!>�?�?�?������,�m�<�<�<�<�<rN)	r r!r"r�r2rWr@r�r�r#rrr�r��si������)�N�7�7�7�
1�1�1�
���C�C�C�=�=�=�=�=rr�c�6�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	dS)	�TestMailOptionParsing�<555 MAIL FROM parameters not recognized or not implemented
c��txt_t_tj|_t
j��x|_t_dSr)r�r1s rr2zTestMailOptionParsing.setUp�r�rc��t���txt_t_|jt_dSr)r�r1s rrWzTestMailOptionParsing.tearDown�r�rc�b�|j�|��|���dSr)r:r�s   rr@z TestMailOptionParsing.write_line�r�rc���ttjdfdd���}|���\}}t�|||d���}|�|d��dD]=}|�||��|�|jj	|j
���>|�|d��|�|jj	d��dS)	Nrr5Tr7r^)�-MAIL from: <foo@example.com> size=20 SMTPUTF8�;MAIL from: <foo@example.com> size=20 SMTPUTF8 BODY=8BITMIMEs1MAIL from: <foo@example.com> size=20 BODY=UNKNOWN�2MAIL from: <foo@example.com> size=20 body=8bitmimer�r�r��rrKrLrMr?r>s      r�test_with_decode_data_truez0TestMailOptionParsing.test_with_decode_data_true�s����m�0�!�4�h�D�Q�Q�Q���]�]�_�_�
��d��#�#�F�D�$�D�#�I�I�������1�1�1�
�	G�	G�D�
�O�O�G�T�*�*�*����W�^�0�$�2E�F�F�F�F�����!H�I�I�I������,�m�<�<�<�<�<rc�(�ttjdfd��}|���\}}t�|||��}|�|d��dD]=}|�||��|�|jj	|j
���>|�|d��|�|jj	d��|�|d��|�|jj	d��dS)	Nrr5r^)r�r�s:MAIL from: <foo@example.com> size=20 SMTPUTF8 BODY=UNKNOWNs3501 Error: BODY can only be one of 7BIT, 8BITMIME
r�r�r�r�s      r�test_with_decode_data_falsez1TestMailOptionParsing.test_with_decode_data_falses(���m�0�!�4�h�?�?���]�]�_�_�
��d��#�#�F�D�$�7�7�������1�1�1�
�	G�	G�D�
�O�O�G�T�*�*�*����W�^�0�$�2E�F�F�F�F�����I�	K�	K�	K�	
����N��D�	F�	F�	F�	
����J�	L�	L�	L������,�m�<�<�<�<�<rc�D�ttjdfdd���}|���\}}t�|||d���}|�|d��|�|d��|�|jj	d��dS)Nrr5Trsr^s;MAIL from: <foo@example.com> size=20 body=8bitmime smtputf8r�r�r�s     r�test_with_enable_smtputf8_truez4TestMailOptionParsing.test_with_enable_smtputf8_trues����m�0�!�4�h�PT�U�U�U���]�]�_�_�
��d��#�#�F�D�$��#�M�M�������1�1�1�����J�	L�	L�	L�	
�����,�m�<�<�<�<�<rN)
r r!r"r�r2rWr@r�r�r�r#rrr�r��su������)�N�7�7�7�
1�1�1�
���=�=�=� =�=�=�*=�=�=�=�=rr�c��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,d+�Z-d,�Z.d-�Z/d.�Z0d/�Z1d0�Z2d1�Z3d2�Z4d3�Z5d4�Z6d5�Z7d6�Z8d7�Z9d8�Z:d9�Z;d:�Z<d;�Z=d<�Z>d=�Z?d>�Z@d?�ZAd@�ZBdA�ZCdB�ZDdC�ZEdDS)E�SMTPDChannelTestc�x�txt_t_tj|_t
j��x|_t_ttjdfdd���|_|j�
��\}}t�|j||d���|_dS�Nrr5Tr7�rrr0rr�r�r�r�r�r
rrFrKrGrHr?�rrLrMs   rr2zSMTPDChannelTest.setUp$s���)4�4���x��$�0���)+����6��
�U�&�!�=�#5�q�"9�8�.2�4�4�4����[�'�'�)�)�
��d��(�(���d�D�59�)�;�;����rc��t���txt_t_|jt_dSr)r�r1s rrWzSMTPDChannelTest.tearDown.r�rc�v�|jj�|��|j���dSr)�r?r0r;r<�rr>s  rr@zSMTPDChannelTest.write_line3�5�����&�&�t�,�,�,��� � �"�"�"�"�"rc�f�|�tttjdfdd���dSr�)rIr%r'rrFr1s r�test_broken_connectz$SMTPDChannelTest.test_broken_connect7sC�����!�#4�
�
��#�X�4�	�	A�	A�	A�	A�	Arc	��|�ttj|j|jj|jjdd���dS)NTrP)rIrRrrHrKr?rLrMr1s rrSz<SMTPDChannelTest.test_decode_data_and_enable_SMTPUTF8_raises<sI�������)��K���*�D�L�,=� �d�	�	4�	4�	4�	4�	4rc�8�|j���dSr))rK�
handle_acceptr1s r�test_server_acceptz#SMTPDChannelTest.test_server_acceptBs����!�!�#�#�#�#�#rc�z�|�d��|�|jjjd��dS)Nrs500 Error: bad syntax
�r@rfr?r0r�r1s r�test_missing_dataz"SMTPDChannelTest.test_missing_dataEsC��������������,�1�5�	7�	7�	7�	7�	7rc�z�|�d��|�|jjjd��dS)Nr^s
250 HELP
r�r1s r�	test_EHLOzSMTPDChannelTest.test_EHLOJs8������(�(�(������,�1�?�C�C�C�C�Crc�z�|�d��|�|jjjd��dS)NsEHLOs501 Syntax: EHLO hostname
r�r1s r�test_EHLO_bad_syntaxz%SMTPDChannelTest.test_EHLO_bad_syntaxN�C������ � � ������,�1�9�	;�	;�	;�	;�	;rc��|�d��|�d��|�|jjjd��dS)Nr^�503 Duplicate HELO/EHLO
r�r1s r�test_EHLO_duplicatez$SMTPDChannelTest.test_EHLO_duplicateS�U������(�(�(�����(�(�(������,�1�7�	9�	9�	9�	9�	9rc��|�d��|�d��|�|jjjd��dS)Nr^rBr�r�r1s r�test_EHLO_HELO_duplicatez)SMTPDChannelTest.test_EHLO_HELO_duplicateYr�rc��tj���}|�d��|�|jjjd�|���d����dS)NrBz250 {}
�ascii)	rr0�getfqdnr@rfr?r��format�encode)r�names  r�	test_HELOzSMTPDChannelTest.test_HELO_sw���|�#�#�%�%������(�(�(������,�1�%�,�,�T�2�2�9�9�'�B�B�	D�	D�	D�	D�	Drc��|�d��|�d��|�|jjjd��dS)NrBr^r�r�r1s r�test_HELO_EHLO_duplicatez)SMTPDChannelTest.test_HELO_EHLO_duplicateer�rc�z�|�d��|�|jjjd��dS)NsHELPsF250 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFY
r�r1s r�	test_HELPzSMTPDChannelTest.test_HELPksE������ � � ������,�1�9�	:�	:�	:�	:�	:rc�z�|�d��|�|jjjd��dS)Ns	HELP MAILs"250 Syntax: MAIL FROM: <address>
r�r1s r�test_HELP_commandz"SMTPDChannelTest.test_HELP_commandqsH������%�%�%������,�1�@�	B�	B�	B�	B�	Brc�z�|�d��|�|jjjd��dS)Ns	HELP SPAMsF501 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFY
r�r1s r�test_HELP_command_unknownz*SMTPDChannelTest.test_HELP_command_unknownvsE������%�%�%������,�1�9�	:�	:�	:�	:�	:rc�z�|�d��|�|jjjd��dS)NsHELOs501 Syntax: HELO hostname
r�r1s r�test_HELO_bad_syntaxz%SMTPDChannelTest.test_HELO_bad_syntax|r�rc��|�d��|�d��|�|jjjd��dS)NrBr�r�r1s r�test_HELO_duplicatez$SMTPDChannelTest.test_HELO_duplicate�r�rc��d|_|�d��|�d��|�|jjjd��dS)NFrBs%MAIL from:<foo@example.com> SIZE=1234�"501 Syntax: MAIL FROM: <address>
)�
extended_smtpr@rfr?r0r�r1s r�8test_HELO_parameter_rejected_when_extensions_not_enabledzISMTPDChannelTest.test_HELO_parameter_rejected_when_extensions_not_enabled�sc��"�������(�(�(����@�A�A�A������,�1�@�	B�	B�	B�	B�	Brc��|�d��|�d��|�|jjjd��dS)NrBsMAIL from:   <foo@example.com>r�r�r1s r�"test_MAIL_allows_space_after_colonz3SMTPDChannelTest.test_MAIL_allows_space_after_colon�sV������(�(�(����9�:�:�:������,�1�&�	(�	(�	(�	(�	(rc��|�d��|�d��|�|jjjd��dS)Nr^s&MAIL from:   <foo@example.com> size=20r�r�r1s r�+test_extended_MAIL_allows_space_after_colonz<SMTPDChannelTest.test_extended_MAIL_allows_space_after_colon�sV������(�(�(����A�B�B�B������,�1�&�	(�	(�	(�	(�	(rc�z�|�d��|�|jjjd��dS)N�NOOPr�r�r1s r�	test_NOOPzSMTPDChannelTest.test_NOOP�s8������ � � ������,�1�=�A�A�A�A�Arc��|�d��|�d��|�|jjjd��dS)NrBr�r�r�r1s r�test_HELO_NOOPzSMTPDChannelTest.test_HELO_NOOP��J������(�(�(����� � � ������,�1�=�A�A�A�A�Arc�z�|�d��|�|jjjd��dS)NsNOOP his501 Syntax: NOOP
r�r1s r�test_NOOP_bad_syntaxz%SMTPDChannelTest.test_NOOP_bad_syntax�sC�����
�#�#�#������,�1�0�	2�	2�	2�	2�	2rc�z�|�d��|�|jjjd��dS)N�QUIT�	221 Bye
r�r1s r�	test_QUITzSMTPDChannelTest.test_QUIT�s8������ � � ������,�1�>�B�B�B�B�Brc��|�d��|�d��|�|jjjd��dS)NrBr�r�r�r1s r�test_HELO_QUITzSMTPDChannelTest.test_HELO_QUIT�sJ������(�(�(����� � � ������,�1�>�B�B�B�B�Brc�z�|�d��|�|jjjd��dS)NsQUIT bye byer�r�r1s r�test_QUIT_arg_ignoredz&SMTPDChannelTest.test_QUIT_arg_ignored�s8������(�(�(������,�1�>�B�B�B�B�Brc��d|j_|�d��|�|jjjd��dS)Nz	BAD STATErBs451 Internal confusion
)r?�
smtp_stater@rfr0r�r1s r�test_bad_statezSMTPDChannelTest.test_bad_state�sM��"-��������(�(�(������,�1�6�	8�	8�	8�	8�	8rc���|�d��|�dd|jjzzdz��|�|jjjd��dS)NrBsMAIL from: �as@example�500 Error: line too long
)r@r?�command_size_limitrfr0r�r1s r�test_command_too_longz&SMTPDChannelTest.test_command_too_long�sw������(�(�(������t�|�>�>�?�#�$�	%�	%�	%�	
�����,�1�8�	:�	:�	:�	:�	:rc�z�|�d��|jjtd��z
}|�dd|zzdz��|�|jjjd��|�dd|dzzzdz��|�|jjjd��dS)	Nr^zMAIL from:<@example>�MAIL from:<rs@example> SIZE=1234r��r)r@r?r�lenrfr0r��r�fill_lens  r�*test_MAIL_command_limit_extended_with_SIZEz;SMTPDChannelTest.test_MAIL_command_limit_extended_with_SIZE�s�������(�(�(��<�2�S�9O�5P�5P�P�������x��(�.�/�	0�	0�	0�	
�����,�1�=�A�A�A�������2�
�.�/�.�/�	0�	0�	0�	
�����,�1�8�	:�	:�	:�	:�	:rc��|�d��|�d��|�|jjjdd�d��dS)Nr^s5MAIL from: <naive@example.com> BODY=8BITMIME SMTPUTF8r��5r�r1s r�-test_MAIL_command_rejects_SMTPUTF8_by_defaultz>SMTPDChannelTest.test_MAIL_command_rejects_SMTPUTF8_by_default�s]������(�(�(����D�	F�	F�	F������,�1�!�A�#�6��=�=�=�=�=rc�Z�d|j_|�d��|�d��|�d��|�d��|�d|jjzdz��|�|jjjd��dS)	N�rBrCrDrE�AsA
.�552 Error: Too much mail data
�r?�data_size_limitr@rfr0r�r1s r�-test_data_longer_than_default_data_size_limitz>SMTPDChannelTest.test_data_longer_than_default_data_size_limit�s���'+���$�����(�(�(����1�2�2�2����/�0�0�0����� � � �����t�|�;�;�!�"�	#�	#�	#������,�1�=�	?�	?�	?�	?�	?rc��|�d��|�d��|�|jjjd��dS)Nr^s!MAIL FROM:<eggs@example> SIZE=512r�r�r1s r�test_MAIL_size_parameterz)SMTPDChannelTest.test_MAIL_size_parameter�sV������(�(�(����<�=�=�=������,�1�&�	(�	(�	(�	(�	(rc��|�d��|�d��|�|jjjd��dS)Nr^s%MAIL FROM:<eggs@example> SIZE=invalid�9501 Syntax: MAIL FROM: <address> [SP <mail-parameters>]
r�r1s r� test_MAIL_invalid_size_parameterz1SMTPDChannelTest.test_MAIL_invalid_size_parameter�s[������(�(�(����@�A�A�A������,�1�J�	L�	L�	L�	L�	Lrc�B�|�d��|�d��|�|jjjd��|�d��|�d��|�|jjjd��dS)Nr^s"MAIL FROM:<eggs@example> ham=greenr�sMAIL FROM:<eggs@example>s RCPT TO:<eggs@example> ham=greenr�r�r1s r�!test_MAIL_RCPT_unknown_parametersz2SMTPDChannelTest.test_MAIL_RCPT_unknown_parameters�s�������(�(�(����=�>�>�>������,�1�M�	O�	O�	O�	
���3�4�4�4����;�<�<�<������,�1�K�	M�	M�	M�	M�	Mrc��d|j_|�d��|�d��|�|jjjd��dS)Nrr^s"MAIL FROM:<eggs@example> SIZE=2096s<552 Error: message size exceeds fixed maximum message size
rr1s r�<test_MAIL_size_parameter_larger_than_default_data_size_limitzMSMTPDChannelTest.test_MAIL_size_parameter_larger_than_default_data_size_limit�se��'+���$�����(�(�(����=�>�>�>������,�1�M�	O�	O�	O�	O�	Orc��|�d��|�d��|�|jjjd��dS)NrBsRCPT to:spam@examples503 Error: need MAIL command
r�r1s r�test_need_MAILzSMTPDChannelTest.test_need_MAILsV������(�(�(����/�0�0�0������,�1�/�	1�	1�	1�	1�	1rc��|�d��|�d��|�|jjjd��dS)NrB�MAIL from eggs@exampler�r�r1s r�test_MAIL_syntax_HELOz&SMTPDChannelTest.test_MAIL_syntax_HELOsV������(�(�(����1�2�2�2������,�1�3�	5�	5�	5�	5�	5rc��|�d��|�d��|�|jjjd��dS)Nr^r'rr�r1s r�test_MAIL_syntax_EHLOz&SMTPDChannelTest.test_MAIL_syntax_EHLO
s[������(�(�(����1�2�2�2������,�1�J�	L�	L�	L�	L�	Lrc��|�d��|�d��|�|jjjd��dS)NrBs
MAIL from:r�r�r1s r�test_MAIL_missing_addressz*SMTPDChannelTest.test_MAIL_missing_addresssU������(�(�(����
�&�&�&������,�1�3�	5�	5�	5�	5�	5rc��|�d��|�d��|�|jjjd��dS)NrBsMAIL from:<eggs@example>r�r�r1s r�test_MAIL_chevronsz#SMTPDChannelTest.test_MAIL_chevronssK������(�(�(����3�4�4�4������,�1�=�A�A�A�A�Arc��|�d��|�d��|�|jjjd��dS)Nr^sMAIL from:<>r�r�r1s r�test_MAIL_empty_chevronsz)SMTPDChannelTest.test_MAIL_empty_chevronssJ������(�(�(�����(�(�(������,�1�=�A�A�A�A�Arc���|�d��|�d��|�|jjjd��|�|jjd��dS)Nr^s%MAIL from: <"Fred Blogs"@example.com>r��"Fred Blogs"@example.com�r@rfr?r0r�rr1s r�test_MAIL_quoted_localpartz+SMTPDChannelTest.test_MAIL_quoted_localpart#sg������(�(�(����@�A�A�A������,�1�=�A�A�A������.�0J�K�K�K�K�Krc���|�d��|�d��|�|jjjd��|�|jjd��dS)Nr^s#MAIL from: "Fred Blogs"@example.comr�r2r3r1s r�$test_MAIL_quoted_localpart_no_anglesz5SMTPDChannelTest.test_MAIL_quoted_localpart_no_angles)sg������(�(�(����>�?�?�?������,�1�=�A�A�A������.�0J�K�K�K�K�Krc���|�d��|�d��|�|jjjd��|�|jjd��dS)Nr^s/MAIL from: <"Fred Blogs"@example.com> SIZE=1000r�r2r3r1s r�$test_MAIL_quoted_localpart_with_sizez5SMTPDChannelTest.test_MAIL_quoted_localpart_with_size/sg������(�(�(����J�K�K�K������,�1�=�A�A�A������.�0J�K�K�K�K�Krc���|�d��|�d��|�|jjjd��|�|jjd��dS)Nr^s-MAIL from: "Fred Blogs"@example.com SIZE=1000r�r2r3r1s r�.test_MAIL_quoted_localpart_with_size_no_anglesz?SMTPDChannelTest.test_MAIL_quoted_localpart_with_size_no_angles5sg������(�(�(����H�I�I�I������,�1�=�A�A�A������.�0J�K�K�K�K�Krc���|�d��|�d��|�d��|�|jjjd��dS)NrBsMAIL from:eggs@examplesMAIL from:spam@examples 503 Error: nested MAIL command
r�r1s r�test_nested_MAILz!SMTPDChannelTest.test_nested_MAIL;si������(�(�(����1�2�2�2����1�2�2�2������,�1�1�	3�	3�	3�	3�	3rc�z�|�d��|�|jjjd��dS)NsVRFY eggs@examplesD252 Cannot VRFY user, but will accept message and attempt delivery
r�r1s r�	test_VRFYzSMTPDChannelTest.test_VRFYBsF�����,�-�-�-������,�1�
�	�	�	�	�	rc�z�|�d��|�|jjjd��dS)NsVRFYs501 Syntax: VRFY <address>
r�r1s r�test_VRFY_syntaxz!SMTPDChannelTest.test_VRFY_syntaxHsC������ � � ������,�1�-�	/�	/�	/�	/�	/rc�z�|�d��|�|jjjd��dS)NsEXPNs502 EXPN not implemented
r�r1s r�test_EXPN_not_implementedz*SMTPDChannelTest.test_EXPN_not_implementedMsC������ � � ������,�1�+�	-�	-�	-�	-�	-rc�z�|�d��|�|jjjd��dS)NsMAIL from:<foo@example.com>�503 Error: send HELO first
r�r1s r�test_no_HELO_MAILz"SMTPDChannelTest.test_no_HELO_MAILRsD�����6�7�7�7������,�1�:�	<�	<�	<�	<�	<rc���|�d��|�d��|�d��|�|jjjd��dS)NrBrCrEs503 Error: need RCPT command
r�r1s r�test_need_RCPTzSMTPDChannelTest.test_need_RCPTWsh������(�(�(����1�2�2�2����� � � ������,�1�/�	1�	1�	1�	1�	1rc���|�d��|�d��|�d��|�|jjjd��dS)NrB�MAIL From: eggs@example�RCPT to eggs@examples 501 Syntax: RCPT TO: <address>
r�r1s r�test_RCPT_syntax_HELOz&SMTPDChannelTest.test_RCPT_syntax_HELO^si������(�(�(����2�3�3�3����/�0�0�0������,�1�1�	3�	3�	3�	3�	3rc���|�d��|�d��|�d��|�|jjjd��dS)Nr^rIrJs7501 Syntax: RCPT TO: <address> [SP <mail-parameters>]
r�r1s r�test_RCPT_syntax_EHLOz&SMTPDChannelTest.test_RCPT_syntax_EHLOesn������(�(�(����2�3�3�3����/�0�0�0������,�1�H�	J�	J�	J�	J�	Jrc���|�d��|�d��|�d��|�|jjjd��dS)NrBrIsRCPT to: <eggs@example>r�r�r1s r�test_RCPT_lowercase_to_OKz*SMTPDChannelTest.test_RCPT_lowercase_to_OKls^������(�(�(����2�3�3�3����2�3�3�3������,�1�=�A�A�A�A�Arc�z�|�d��|�|jjjd��dS)NrJrDr�r1s r�test_no_HELO_RCPTz"SMTPDChannelTest.test_no_HELO_RCPTrsD�����/�0�0�0������,�1�:�	<�	<�	<�	<�	<rc�L�|�d��|�d��|�|jjjd��|�d��|�|jjjd��|�d��|�|jjjd��|�d��|�|jjjd��|�|jjdd	d
gdfg��dS�NrBrCr�rDrE�%354 End data with <CR><LF>.<CR><LF>
s
data
more
.�zpeer-addressz	peer-port�eggs@example�spam@examplez	data
more�r@rfr?r0r�rKrr1s r�test_data_dialogz!SMTPDChannelTest.test_data_dialogw� ������(�(�(����1�2�2�2������,�1�=�A�A�A����/�0�0�0������,�1�=�A�A�A����� � � ������,�1�6�	8�	8�	8����,�-�-�-������,�1�=�A�A�A������-�+������
�	�	�	�	�	rc��|�d��|�d��|�d��|�d��|�|jjjd��dS)NrBrCrD�	DATA spams501 Syntax: DATA
r�r1s r�test_DATA_syntaxz!SMTPDChannelTest.test_DATA_syntax�sq������(�(�(����1�2�2�2����/�0�0�0�����%�%�%������,�1�3J�K�K�K�K�Krc�z�|�d��|�|jjjd��dS)Nr\rDr�r1s r�test_no_HELO_DATAz"SMTPDChannelTest.test_no_HELO_DATA�sC������%�%�%������,�1�:�	<�	<�	<�	<�	<rc��|�d��|�d��|�d��|�d��|�d��|�|jjd��dS)NrBrCrDrEs..
.
�.�r@rfr?�
received_datar1s r�$test_data_transparency_section_4_5_2z5SMTPDChannelTest.test_data_transparency_section_4_5_2�s������(�(�(����1�2�2�2����/�0�0�0����� � � �����'�'�'������3�S�9�9�9�9�9rc�P�|�d��|�d��|�d��|�d��|�d��|�d��|�|jjddd	d
gdfg��dS)NrBrCrDsRCPT To:ham@examplerE�data
.rUrVrWzham@exampler)r@rfrKrr1s r�test_multiple_RCPTz#SMTPDChannelTest.test_multiple_RCPT�s�������(�(�(����1�2�2�2����/�0�0�0����.�/�/�/����� � � �����%�%�%������-�+���m�,���
�	�	�	�	�	rc�"�|�d��|�d��|�d��|�d��|�d��|�|jjjd��dS)NrBrCrDrEsreturn status
.s250 Okish
r�r1s r�test_manual_statusz#SMTPDChannelTest.test_manual_status�s�������(�(�(����1�2�2�2����/�0�0�0����� � � ����-�.�.�.������,�1�3C�D�D�D�D�Drc���|�d��|�d��|�d��|�d��|�|jjjd��|�d��|�d��|�d��|�d	��|�|jjd
ddgd
fg��dS)NrBrCrD�RSETr�sMAIL From:foo@examplesRCPT To:eggs@examplerErfrUzfoo@examplerVrrXr1s r�	test_RSETzSMTPDChannelTest.test_RSET�s�������(�(�(����1�2�2�2����/�0�0�0����� � � ������,�1�=�A�A�A����0�1�1�1����/�0�0�0����� � � �����%�%�%������-�+������
�	�	�	�	�	rc��|�d��|�d��|�|jjjd��dS)NrBrkr�r�r1s r�test_HELO_RSETzSMTPDChannelTest.test_HELO_RSET�r�rc�z�|�d��|�|jjjd��dS)NsRSET his501 Syntax: RSET
r�r1s r�test_RSET_syntaxz!SMTPDChannelTest.test_RSET_syntax�s9�����
�#�#�#������,�1�3J�K�K�K�K�Krc�z�|�d��|�|jjjd��dS)NsUNKNOWN_CMDs1500 Error: command "UNKNOWN_CMD" not recognized
r�r1s r�test_unknown_commandz%SMTPDChannelTest.test_unknown_command�sE������'�'�'������,�1�+�	,�	,�	,�	,�	,rc��
�tjdtf��5|jj}ddd��n#1swxYwYtjdtf��5d|j_ddd��n#1swxYwYtjdtf��5|jj}ddd��n#1swxYwYtjdtf��5d|j_ddd��n#1swxYwYtjdtf��5|jj}ddd��n#1swxYwYtjdtf��5d|j_ddd��n#1swxYwYtjdtf��5|jj}ddd��n#1swxYwYtjdtf��5d|j_ddd��n#1swxYwYtjdtf��5|jj}ddd��n#1swxYwYtjdtf��5d|j_ddd��n#1swxYwYtjdtf��5|jj	}ddd��n#1swxYwYtjdtf��5d|j_	ddd��n#1swxYwYtjdtf��5|jj
}ddd��n#1swxYwYtjdtf��5d|j_
ddd��n#1swxYwYtjdtf��5|jj}ddd��n#1swxYwYtjdtf��5d|j_ddd��n#1swxYwYtjdtf��5|jj}ddd��n#1swxYwYtjdtf��5d|j_ddd��n#1swxYwYtjdtf��5|jj
}ddd��n#1swxYwYtjdtf��5d|j_
ddd��n#1swxYwYtjdtf��5|jj}ddd��n#1swxYwYtjdtf��5d|j_ddd��dS#1swxYwYdS)N��spam)r�check_warnings�DeprecationWarningr?�_SMTPChannel__server�_SMTPChannel__line�_SMTPChannel__state�_SMTPChannel__greeting�_SMTPChannel__mailfrom�_SMTPChannel__rcpttos�_SMTPChannel__data�_SMTPChannel__fqdn�_SMTPChannel__peer�_SMTPChannel__conn�_SMTPChannel__addr)rrus  r�test_attribute_deprecationsz,SMTPDChannelTest.test_attribute_deprecations�s5
��
�
+�R�1C�,D�
E�
E�	5�	5��<�4�D�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�
�
+�R�1C�,D�
E�
E�	7�	7�06�D�L�-�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7����	7�	7�	7�	7�
�
+�R�1C�,D�
E�
E�	3�	3��<�2�D�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3�
�
+�R�1C�,D�
E�
E�	5�	5�.4�D�L�+�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�
�
+�R�1C�,D�
E�
E�	4�	4��<�3�D�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4����	4�	4�	4�	4�
�
+�R�1C�,D�
E�
E�	6�	6�/5�D�L�,�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6�
�
+�R�1C�,D�
E�
E�	7�	7��<�6�D�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7����	7�	7�	7�	7�
�
+�R�1C�,D�
E�
E�	9�	9�28�D�L�/�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9����	9�	9�	9�	9�
�
+�R�1C�,D�
E�
E�	7�	7��<�6�D�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7�	7����	7�	7�	7�	7�
�
+�R�1C�,D�
E�
E�	9�	9�28�D�L�/�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9����	9�	9�	9�	9�
�
+�R�1C�,D�
E�
E�	6�	6��<�5�D�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6�
�
+�R�1C�,D�
E�
E�	8�	8�17�D�L�.�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8����	8�	8�	8�	8�
�
+�R�1C�,D�
E�
E�	3�	3��<�2�D�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3�
�
+�R�1C�,D�
E�
E�	5�	5�.4�D�L�+�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�
�
+�R�1C�,D�
E�
E�	3�	3��<�2�D�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3�
�
+�R�1C�,D�
E�
E�	5�	5�.4�D�L�+�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�
�
+�R�1C�,D�
E�
E�	3�	3��<�2�D�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3�
�
+�R�1C�,D�
E�
E�	5�	5�.4�D�L�+�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�
�
+�R�1C�,D�
E�
E�	3�	3��<�2�D�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3�
�
+�R�1C�,D�
E�
E�	5�	5�.4�D�L�+�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�
�
+�R�1C�,D�
E�
E�	3�	3��<�2�D�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3�
�
+�R�1C�,D�
E�
E�	5�	5�.4�D�L�+�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5�	5����	5�	5�	5�	5�	5�	5s��
5�9�9�
A4�4A8�;A8�
B3�3B7�:B7�
C2�2C6�9C6�
D1�1D5�8D5�
E0�0E4�7E4�
F/�/F3�6F3�
G.�.G2�5G2�
H-�-H1�4H1�
I,�,I0�3I0�
J+�+J/�2J/�
K*�*K.�1K.�
L)�)L-�0L-�
M(�(M,�/M,�
N'�'N+�.N+�

O&�&O*�-O*�
P%�%P)�,P)�
Q$�$Q(�+Q(�

R#�#R'�*R'�	
S"�"S&�)S&�
T!�!T%�(T%�
U!�!U%�(U%N)Fr r!r"r2rWr@r�rSr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrrr!r#r%r(r*r,r.r0r4r6r8r:r<r>r@rBrErGrKrMrOrQrYr]r_rdrgrirlrnrprrr�r#rrr�r�#sO������;�;�;�1�1�1�
#�#�#�A�A�A�
4�4�4�$�$�$�7�7�7�
D�D�D�;�;�;�
9�9�9�9�9�9�D�D�D�9�9�9�:�:�:�B�B�B�
:�:�:�;�;�;�
9�9�9�B�B�B�(�(�(�(�(�(�B�B�B�B�B�B�
2�2�2�
C�C�C�C�C�C�
C�C�C�8�8�8�:�:�:�:�:�:�>�>�>�
?�
?�
?�(�(�(�L�L�L�	M�	M�	M�O�O�O�1�1�1�5�5�5�L�L�L�5�5�5�B�B�B�
B�B�B�
L�L�L�L�L�L�L�L�L�L�L�L�3�3�3����/�/�/�
-�-�-�
<�<�<�
1�1�1�3�3�3�J�J�J�B�B�B�<�<�<�
���$L�L�L�<�<�<�
:�:�:����E�E�E���� B�B�B�
L�L�L�,�,�,�,5�,5�,5�,5�,5rr�r|c��eZdZd�ZdS)�SMTPDChannelIPv6Testc�x�txt_t_tj|_t
j��x|_t_ttjdfdd���|_|j�
��\}}t�|j||d���|_dSr�)rrr0rr�r�r�r�r�r
rrrKrGrHr?r�s   rr2zSMTPDChannelIPv6Test.setUps���)4�4���x��$�0���)+����6��
�U�&�!�=�#7��";�X�.2�4�4�4����[�'�'�)�)�
��d��(�(���d�D�59�)�;�;����rN)r r!r"r2r#rrr�r�s#������;�;�;�;�;rr�c�,�eZdZd�Zd�Zd�Zd�Zd�ZdS)�!SMTPDChannelWithDataSizeLimitTestc�z�txt_t_tj|_t
j��x|_t_ttjdfdd���|_|j�
��\}}t�|j||dd���|_dS)Nrr5Tr7� r�r�s   rr2z'SMTPDChannelWithDataSizeLimitTest.setUps���)4�4���x��$�0���)+����6��
�U�&�!�=�#5�q�"9�8�.2�4�4�4����[�'�'�)�)�
��d��(�(���d�D�"�59�)�;�;����rc��t���txt_t_|jt_dSr)r�r1s rrWz*SMTPDChannelWithDataSizeLimitTest.tearDownr�rc�v�|jj�|��|j���dSr)r�r�s  rr@z,SMTPDChannelWithDataSizeLimitTest.write_liner�rc�L�|�d��|�d��|�|jjjd��|�d��|�|jjjd��|�d��|�|jjjd��|�d��|�|jjjd��|�|jjdd	d
gdfg��dSrSrXr1s r�test_data_limit_dialogz8SMTPDChannelWithDataSizeLimitTest.test_data_limit_dialog"rZrc��|�d��|�d��|�|jjjd��|�d��|�|jjjd��|�d��|�|jjjd��|�d��|�|jjjd��dS)	NrBrCr�rDrErTs'This message is longer than 32 bytes
.rr�r1s r�$test_data_limit_dialog_too_much_datazFSMTPDChannelWithDataSizeLimitTest.test_data_limit_dialog_too_much_data4s�������(�(�(����1�2�2�2������,�1�=�A�A�A����/�0�0�0������,�1�=�A�A�A����� � � ������,�1�6�	8�	8�	8����D�E�E�E������,�1�=�	?�	?�	?�	?�	?rN)r r!r"r2rWr@r�r�r#rrr�r�s_������	;�	;�	;�1�1�1�
#�#�#����$?�?�?�?�?rr�c�,�eZdZd�Zd�Zd�Zd�Zd�ZdS)�SMTPDChannelWithDecodeDataFalsec�p�txt_t_tj|_t
j��x|_t_ttjdfd��|_|j�
��\}}t�|j||��|_dS)Nrr5r�r�s   rr2z%SMTPDChannelWithDecodeDataFalse.setUpEs��)4�4���x��$�0���)+����6��
�U�&�!�=�#5�q�"9�8�D�D����[�'�'�)�)�
��d��(�(���d�D�A�A����rc��t���txt_t_|jt_dSr)r�r1s rrWz(SMTPDChannelWithDecodeDataFalse.tearDownMr�rc�v�|jj�|��|j���dSr)r�r�s  rr@z*SMTPDChannelWithDecodeDataFalse.write_lineRr�rc�B�|�d��|�d��|�d��|�d��|�d��|�d��|�|jjd��dS)NrBrCrDrE�plain ascii textr_rbr1s r�test_ascii_dataz/SMTPDChannelWithDecodeDataFalse.test_ascii_dataVs�������(�(�(����1�2�2�2����/�0�0�0����� � � ����+�,�,�,�������������3�5H�I�I�I�I�Irc�l�|�d��|�d��|�d��|�d��|�d��|�d��|�d��|�|jjd��dS)	NrBrCrDrE�utf8 enriched text: żźć�and some plain asciir_s/utf8 enriched text: żźć
and some plain asciirbr1s r�test_utf8_dataz.SMTPDChannelWithDecodeDataFalse.test_utf8_data_s�������(�(�(����1�2�2�2����/�0�0�0����� � � ����G�H�H�H����/�0�0�0������������L�&�
(�	)�	)�	)�	)�	)rN�r r!r"r2rWr@r�r�r#rrr�r�Cse������B�B�B�1�1�1�
#�#�#�J�J�J�)�)�)�)�)rr�c�,�eZdZd�Zd�Zd�Zd�Zd�ZdS)�SMTPDChannelWithDecodeDataTruec�x�txt_t_tj|_t
j��x|_t_ttjdfdd���|_|j�
��\}}t�|j||d���|_dSr�r�r�s   rr2z$SMTPDChannelWithDecodeDataTrue.setUpos���)4�4���x��$�0���)+����6��
�U�&�!�=�#5�q�"9�8�.2�4�4�4����[�'�'�)�)�
��d��(�(���d�D� �)�"�"����rc��t���txt_t_|jt_dSr)r�r1s rrWz'SMTPDChannelWithDecodeDataTrue.tearDownzr�rc�v�|jj�|��|j���dSr)r�r�s  rr@z)SMTPDChannelWithDecodeDataTrue.write_liner�rc�B�|�d��|�d��|�d��|�d��|�d��|�d��|�|jjd��dS)NrBrCrDrEr�r_zplain ascii textrbr1s rr�z.SMTPDChannelWithDecodeDataTrue.test_ascii_data�s�������(�(�(����1�2�2�2����/�0�0�0����� � � ����+�,�,�,�������������3�5G�H�H�H�H�Hrc�l�|�d��|�d��|�d��|�d��|�d��|�d��|�d��|�|jjd��dS)	NrBrCrDrEr�r�r_u/utf8 enriched text: żźć
and some plain asciirbr1s rr�z-SMTPDChannelWithDecodeDataTrue.test_utf8_data�s�������(�(�(����1�2�2�2����/�0�0�0����� � � ����G�H�H�H����/�0�0�0������������L�&�>�	@�	@�	@�	@�	@rNr�r#rrr�r�msg������	"�	"�	"�1�1�1�
#�#�#�I�I�I�
@�
@�
@�
@�
@rr�c�>�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	S)
�&SMTPDChannelTestWithEnableSMTPUTF8Truec�x�txt_t_tj|_t
j��x|_t_ttjdfdd���|_|j�
��\}}t�|j||d���|_dS)Nrr5Trsr�r�s   rr2z,SMTPDChannelTestWithEnableSMTPUTF8True.setUp�s���)4�4���x��$�0���)+����6��
�U�&�!�=�#5�q�"9�8�26�8�8�8����[�'�'�)�)�
��d��(�(���d�D�9=�)�?�?����rc��t���txt_t_|jt_dSr)r�r1s rrWz/SMTPDChannelTestWithEnableSMTPUTF8True.tearDown�r�rc�v�|jj�|��|j���dSr)r�r�s  rr@z1SMTPDChannelTestWithEnableSMTPUTF8True.write_line�r�rc���|�d��|�d�d����|�|jjjd��dS)Nr^u7MAIL from: <naïve@example.com> BODY=8BITMIME SMTPUTF8�utf-8r�)r@r�rfr?r0r�r1s r�1test_MAIL_command_accepts_SMTPUTF8_when_announcedzXSMTPDChannelTestWithEnableSMTPUTF8True.test_MAIL_command_accepts_SMTPUTF8_when_announced�sf������(�(�(����E�L�L��
�
�	
�	
�	
�	
�����,�1�=�A�A�A�A�Arc��|�d��dD�]3}|�d|z��|�|jjjdd�d��|�d��|�|jjjdd�d��|�d��|�|jjjdd�d	��|�d
��|dkr'|�|jjjd����|�|jjjd
����5dS)Nr^)rsBODY=8BITMIME SMTPUTF8sMAIL from: <a@example> r��250srcpt to:<b@example.com>�data�354sc
.rr�s250 SMTPUTF8 message okish
r�)r�mail_parameterss  r�test_process_smtputf8_messagezDSMTPDChannelTestWithEnableSMTPUTF8True.test_process_smtputf8_message�sO������(�(�(�?�	D�	D�O��O�O�6��H�I�I�I����T�\�0�5�a��c�:�F�C�C�C��O�O�6�7�7�7����T�\�0�5�a��c�:�F�C�C�C��O�O�G�$�$�$����T�\�0�5�a��c�:�F�C�C�C��O�O�I�&�&�&��#�%�%�� � ���!4�!9�=�I�I�I�I�� � ���!4�!9�!B�D�D�D�D�	D�	Drc��|�d��|�d�d����|�|jjjdd�d��|�d�d����|�|jjjdd�d��|�d��|�|jjjdd�d	��|�d
��|�d��|�|jjd
��dS)Nr^u2MAIL From: naïve@examplé BODY=8BITMIME SMTPUTF8r�rr�r�uRCPT To:späm@examplérEr�r�r_)r@r�rfr?r0r�rcr1s rr�z5SMTPDChannelTestWithEnableSMTPUTF8True.test_utf8_data�s8������(�(�(����@�G�G��P�P�	R�	R�	R������,�1�!�A�#�6��?�?�?����0�7�7��@�@�A�A�A������,�1�!�A�#�6��?�?�?����� � � ������,�1�!�A�#�6��?�?�?����G�H�H�H������������L�&�;�	=�	=�	=�	=�	=rc�f�|�d��dtd��z
}|�dd|dzzzdz��|�|jjjd��|�dd|zzdz��|�|jjjd	��dS)
N�ehlo example�$�mail from:<@example>r
rr�	@example>rr��r@rrfr?r0r�r
s  r�7test_MAIL_command_limit_extended_with_SIZE_and_SMTPUTF8z^SMTPDChannelTestWithEnableSMTPUTF8True.test_MAIL_command_limit_extended_with_SIZE_and_SMTPUTF8�s�������(�(�(�!�S�)?�%@�%@�@��������1��-�.�$�%�	&�	&�	&�	
�����,�1�8�	:�	:�	:������x��(�$�%�	&�	&�	&�	
�����,�1�=�A�A�A�A�Arc��|�d��dtd��z
}dD�]_}|�d||zzdz��|�|jjjdd�d	��|�d||zzd
z��|�|jjjdd�d��|�d��|�|jjjdd�d��|�d
��|�|jjjdd�d��|�d��|�|jjjdd�d����adS)Nr�r�r�)r�b�cr
s
a@example>rr�s500r�r�srcpt to:<hans@example.com>r�r�stest
.r�)rr�chars   r�1test_multiple_emails_with_extended_command_lengthzXSMTPDChannelTestWithEnableSMTPUTF8True.test_multiple_emails_with_extended_command_length�s�������(�(�(�!�S�)?�%@�%@�@��&�
	D�
	D�D��O�O�N�T�H�_�<�}�L�M�M�M����T�\�0�5�a��c�:�F�C�C�C��O�O�N�T�H�_�<�|�K�L�L�L����T�\�0�5�a��c�:�F�C�C�C��O�O�9�:�:�:����T�\�0�5�a��c�:�F�C�C�C��O�O�G�$�$�$����T�\�0�5�a��c�:�F�C�C�C��O�O�L�)�)�)����T�\�0�5�a��c�:�F�C�C�C�C�
	D�
	DrN)r r!r"r2rWr@r�r�r�r�r�r#rrr�r��s�������?�?�?�1�1�1�
#�#�#�B�B�B�D�D�D� 
=�
=�
=�B�B�B�
D�
D�
D�
D�
Drr�c��eZdZd�ZdS)�MiscTestCasec�F�hd�}tj|t|���dS)N>	�usage�Devnull�NEWLINE�Options�program�	parseargs�
COMMASPACEr��DATA_SIZE_DEFAULT)�not_exported)r�check__all__r)rr�s  r�test__all__zMiscTestCase.test__all__�s3��
�
�
��	��T�5�|�D�D�D�D�D�DrN)r r!r"r�r#rrr�r��s(������E�E�E�E�Err��__main__)%r�rg�testrr�test.supportrrr0r��import_deprecatedrr�has_gethostname�SkipTestrr
�	Exceptionr%r'�TestCaser-rZryr�r�r�r�r�r�r�r�r�r�r�r �mainr#rr�<module>r�s�����������%�%�%�%�%�%�%�%�&�&�&�&�&�&�(�(�(�(�(�(�
�
�
�
�	�	�	�	�	*��)�'�2�2��,�?�,�Z�8�8���$�;�
�(�
�9�
:�
:�:�0�0�0�0�0�%�"�0�0�0�"	�	�	�	�	�I�	�	�	�&�&�&�&�&��&�&�&�
0�0�0�0�0�h�'�0�0�0�DZ0�Z0�Z0�Z0�Z0�(�+�Z0�Z0�Z0�z?�?�?�?�?�(�+�?�?�?�$"=�"=�"=�"=�"=�H�-�"=�"=�"=�J?=�?=�?=�?=�?=�H�-�?=�?=�?=�D[5�[5�[5�[5�[5�x�(�[5�[5�[5�z���]�/�1C�D�D�	;�	;�	;�	;�	;�+�	;�	;�E�D�	;�4?�4?�4?�4?�4?��(9�4?�4?�4?�n')�')�')�')�')�h�&7�')�')�')�T)@�)@�)@�)@�)@�X�%6�)@�)@�)@�XUD�UD�UD�UD�UD�X�->�UD�UD�UD�pE�E�E�E�E�8�$�E�E�E��z����H�M�O�O�O�O�O��r