Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/test/__pycache__/test_smtpd.cpython-39.opt-1.pyc

a

��gK��@sxddlZddlZddlmZmZddlmZddlZddlZddl	Z	ddl
Z
Gdd�de	j�ZGdd�de
�ZGdd	�d	e�ZGd
d�dej�ZGdd
�d
ej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�Ze�ejd�Gdd�de��ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd �d ej�ZGd!d"�d"ej�Zed#k�rte� �dS)$�N)�support�mock_socket)�
socket_helperc@seZdZdd�Zdd�ZdS)�DummyServercOs8tjj|g|�Ri|��g|_|jr.d|_nd|_dS)Nz
return statuss
return status)�smtpd�
SMTPServer�__init__�messagesZ_decode_data�
return_status)�self�args�kwargs�r�+/usr/local/lib/python3.9/test/test_smtpd.pyrs
zDummyServer.__init__cKs>|j�||||f�||jkr"dSd|vr:d|dvr:dSdS)Nz	250 OkishZmail_optionsZSMTPUTF8z250 SMTPUTF8 message okish)r	�appendr
)rZpeer�mailfromZrcpttos�data�kwrrr�process_messages

zDummyServer.process_messageN)�__name__�
__module__�__qualname__rrrrrrrsrc@seZdZdS)�DummyDispatcherBrokenN)rrrrrrrrsrc@seZdZdd�ZdS)�BrokenDummyServercCs
t��dS�N)r)r�numrrr�listen!szBrokenDummyServer.listenN)rrrrrrrrr src@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�SMTPDServerTestcCstt_t_dSr�rr�socket�asyncore�rrrr�setUp&szSMTPDServerTest.setUpcsrtjtjdfddd�}|��\}}tj|||dd���fdd�}|d�|d�|d	�|d
�|�t|d�dS)Nr��brT��decode_datacs�j�|����dSr�r�
queue_recv�handle_read��line��channelrr�
write_line/szFSMTPDServerTest.test_process_message_unimplemented.<locals>.write_line�HELO example�MAIL From:eggs@example�RCPT To:spam@example�DATAs	spam
.
)rrr�HOST�accept�SMTPChannel�assertRaises�NotImplementedError)r�server�conn�addrr.rr,r�"test_process_message_unimplemented)s�z2SMTPDServerTest.test_process_message_unimplementedcCs"|jttjtjdfdddd�dS)Nrr#T��enable_SMTPUTF8r&)r6�
ValueErrorrrrr3r!rrr�+test_decode_data_and_enable_SMTPUTF8_raises9s�z;SMTPDServerTest.test_decode_data_and_enable_SMTPUTF8_raisescCst��tt_t_dSr�r �	close_allrrr!rrr�tearDownBszSMTPDServerTest.tearDownN)rrrr"r;r?rBrrrrr%s	rc@sFeZdZdd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�DebuggingServerTestcCstt_t_dSrrr!rrrr"IszDebuggingServerTest.setUpFcsN�fdd�}|d�|r"|d�n|d�|d�|d�||�|d�dS)	Ncs�j�|����dSrr'r*r,rrr.Msz1DebuggingServerTest.send_data.<locals>.write_line�EHLO examples-MAIL From:eggs@example BODY=8BITMIME SMTPUTF8r0r1r2�.r)rr-rr=r.rr,r�	send_dataLs
zDebuggingServerTest.send_datacCs�tjtjdfddd�}|��\}}tj|||dd�}t���}|�|d�Wd�n1s^0Y|�	�}|�
|t�d��dS)Nrr#Tr%sFrom: test

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

             hello
             ------------ END MESSAGE ------------
             �
rZDebuggingServerrr3r4r5rZcaptured_stdoutrF�getvalue�assertEqual�textwrap�dedent�rr8r9r:r-�s�stdoutrrr�*test_process_message_with_decode_data_trueZs�
*z>DebuggingServerTest.test_process_message_with_decode_data_truecCs~t�tjdfd�}|��\}}t�|||�}t���}|�|d�Wd�n1sV0Y|�	�}|�
|t�d��dS)Nrr#�From: test

héllo�
��             ---------- MESSAGE FOLLOWS ----------
             b'From: test'
             b'X-Peer: peer-address'
             b''
             b'h\xc3\xa9llo\xff'
             ------------ END MESSAGE ------------
             rGrLrrr�+test_process_message_with_decode_data_falseks
*z?DebuggingServerTest.test_process_message_with_decode_data_falsecCs�tjtjdfddd�}|��\}}tj|||dd�}t���}|�|d�Wd�n1s^0Y|�	�}|�
|t�d��dS)Nrr#T�r=rPrQrGrLrrr�.test_process_message_with_enable_SMTPUTF8_true{s�
*zBDebuggingServerTest.test_process_message_with_enable_SMTPUTF8_truecCs�tjtjdfddd�}|��\}}tj|||dd�}t��� }|j|ddd�Wd�n1sb0Y|�	�}|�
|t�d��dS)Nrr#TrSrPa             ---------- MESSAGE FOLLOWS ----------
             mail options: ['BODY=8BITMIME', 'SMTPUTF8']
             b'From: test'
             b'X-Peer: peer-address'
             b''
             b'h\xc3\xa9llo\xff'
             ------------ END MESSAGE ------------
             rGrLrrr�7test_process_SMTPUTF8_message_with_enable_SMTPUTF8_true�s�
�$zKDebuggingServerTest.test_process_SMTPUTF8_message_with_enable_SMTPUTF8_truecCst��tt_t_dSrr@r!rrrrB�szDebuggingServerTest.tearDownN)F)
rrrr"rFrOrRrTrUrBrrrrrCGs
rCc@s:eZdZdd�Zdd�Ze�ejd�dd��Z	dd	�Z
d
S)�TestFamilyDetectioncCstt_t_dSrrr!rrrr"�szTestFamilyDetection.setUpcCst��tt_t_dSrr@r!rrrrB�szTestFamilyDetection.tearDown�IPv6 not enabledcCs.t�tjdftjdf�}|�|jjtj�dS�Nr)	rrr�HOSTv6�HOSTv4rIr�family�AF_INET6�rr8rrr�test_socket_uses_IPv6�sz)TestFamilyDetection.test_socket_uses_IPv6cCs.t�tjdftjdf�}|�|jjtj�dSrX)	rrrrZrYrIrr[�AF_INETr]rrr�test_socket_uses_IPv4�sz)TestFamilyDetection.test_socket_uses_IPv4N)rrrr"rB�unittest�
skipUnlessr�IPV6_ENABLEDr^r`rrrrrV�s

rVc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�TestRcptOptionParsing�:555 RCPT TO parameters not recognized or not implemented
cCs(tt_t_tj|_t��|_t_dSr�	rrrr �DEBUGSTREAM�old_debugstream�io�StringIO�debugr!rrrr"�szTestRcptOptionParsing.setUpcCs t��tt_t_|jt_dSr�r rArrrhrgr!rrrrB�szTestRcptOptionParsing.tearDowncCs|j�|�|��dSrr'�rr-r+rrrr.�sz TestRcptOptionParsing.write_linecCsdttjdfd�}|��\}}t�|||�}|�|d�|�|d�|�|d�|�|jj	|j
�dS)Nrr#rD�$MAIL from: <foo@example.com> size=20s"RCPT to: <foo@example.com> foo=bar�rrr3r4rr5r.rIr�last�error_response�rr8r9r:r-rrr�test_params_rejected�sz*TestRcptOptionParsing.test_params_rejectedcCsbttjdfd�}|��\}}t�|||�}|�|d�|�|d�|�|d�|�|jj	d�dS)Nrr#rDrnsRCPT to: <foo@example.com>�250 OK
�
rrr3r4rr5r.rIrrprrrrr�test_nothing_accepted�sz+TestRcptOptionParsing.test_nothing_acceptedN)	rrrrqr"rBr.rsrvrrrrrd�s	rdc@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�TestMailOptionParsing�<555 MAIL FROM parameters not recognized or not implemented
cCs(tt_t_tj|_t��|_t_dSrrfr!rrrr"�szTestMailOptionParsing.setUpcCs t��tt_t_|jt_dSrrlr!rrrrB�szTestMailOptionParsing.tearDowncCs|j�|�|��dSrr'rmrrrr.�sz TestMailOptionParsing.write_linecCs�ttjdfddd�}|��\}}tj|||dd�}|�|d�dD]"}|�||�|�|jj	|j
�qB|�|d�|�|jj	d�dS)	Nrr#Tr%rD)�-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=8bitmimernrtro�rr8r9r:r-r+rrr�test_with_decode_data_true�sz0TestMailOptionParsing.test_with_decode_data_truecCs�ttjdfd�}|��\}}t�|||�}|�|d�dD]"}|�||�|�|jj	|j
�q:|�|d�|�|jj	d�|�|d�|�|jj	d�dS)	Nrr#rD)ryrzs:MAIL from: <foo@example.com> size=20 SMTPUTF8 BODY=UNKNOWNs3501 Error: BODY can only be one of 7BIT, 8BITMIME
r{rtror|rrr�test_with_decode_data_false�s&���z1TestMailOptionParsing.test_with_decode_data_falsecCs^ttjdfddd�}|��\}}tj|||dd�}|�|d�|�|d�|�|jj	d�dS)Nrr#TrSrDs;MAIL from: <foo@example.com> size=20 body=8bitmime smtputf8rtrurrrrr�test_with_enable_smtputf8_trues�z4TestMailOptionParsing.test_with_enable_smtputf8_trueN)
rrrrqr"rBr.r}r~rrrrrrw�srwc@s$eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dSdT�Z,dUdV�Z-dWdX�Z.dYdZ�Z/d[d\�Z0d]d^�Z1d_d`�Z2dadb�Z3dcdd�Z4dedf�Z5dgdh�Z6didj�Z7dkdl�Z8dmdn�Z9dodp�Z:dqdr�Z;dsdt�Z<dudv�Z=dwdx�Z>dydz�Z?d{d|�Z@d}d~�ZAdd��ZBd�d��ZCd�d��ZDd�d��ZEd�S)��SMTPDChannelTestcCsbtt_t_tj|_t��|_t_t	t
jdfddd�|_|j�
�\}}tj|j||dd�|_dS�Nrr#Tr%�rrrr rgrhrirjrkrrr3r8r4r5r-�rr9r:rrrr"s��zSMTPDChannelTest.setUpcCs t��tt_t_|jt_dSrrlr!rrrrB(szSMTPDChannelTest.tearDowncCs|jj�|�|j��dSr�r-rr(r)�rr+rrrr.-szSMTPDChannelTest.write_linecCs|jtttjdfddd�dSr�)r6rrrr3r!rrr�test_broken_connect1s�z$SMTPDChannelTest.test_broken_connectc	Cs(|jttj|j|jj|jjddd�dS)NTr<)r6r>rr5r8r-r9r:r!rrrr?6s
�z<SMTPDChannelTest.test_decode_data_and_enable_SMTPUTF8_raisescCs|j��dSr)r8Z
handle_acceptr!rrr�test_server_accept<sz#SMTPDChannelTest.test_server_acceptcCs |�d�|�|jjjd�dS)N�s500 Error: bad syntax
�r.rIr-rrpr!rrr�test_missing_data?s
�z"SMTPDChannelTest.test_missing_datacCs |�d�|�|jjjd�dS)NrDs
250 HELP
r�r!rrr�	test_EHLODs
zSMTPDChannelTest.test_EHLOcCs |�d�|�|jjjd�dS)NsEHLOs501 Syntax: EHLO hostname
r�r!rrr�test_EHLO_bad_syntaxHs
�z%SMTPDChannelTest.test_EHLO_bad_syntaxcCs*|�d�|�d�|�|jjjd�dS)NrD�503 Duplicate HELO/EHLO
r�r!rrr�test_EHLO_duplicateMs


�z$SMTPDChannelTest.test_EHLO_duplicatecCs*|�d�|�d�|�|jjjd�dS)NrDr/r�r�r!rrr�test_EHLO_HELO_duplicateSs


�z)SMTPDChannelTest.test_EHLO_HELO_duplicatecCs6tj��}|�d�|�|jjjd�|��d��dS)Nr/z250 {}
�ascii)	rr�getfqdnr.rIr-rp�format�encode)r�namerrr�	test_HELOYs


�zSMTPDChannelTest.test_HELOcCs*|�d�|�d�|�|jjjd�dS)Nr/rDr�r�r!rrr�test_HELO_EHLO_duplicate_s


�z)SMTPDChannelTest.test_HELO_EHLO_duplicatecCs |�d�|�|jjjd�dS)NsHELPsF250 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFY
r�r!rrr�	test_HELPes
�zSMTPDChannelTest.test_HELPcCs |�d�|�|jjjd�dS)Ns	HELP MAILs"250 Syntax: MAIL FROM: <address>
r�r!rrr�test_HELP_commandks
�z"SMTPDChannelTest.test_HELP_commandcCs |�d�|�|jjjd�dS)Ns	HELP SPAMsF501 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFY
r�r!rrr�test_HELP_command_unknownps
�z*SMTPDChannelTest.test_HELP_command_unknowncCs |�d�|�|jjjd�dS)NsHELOs501 Syntax: HELO hostname
r�r!rrr�test_HELO_bad_syntaxvs
�z%SMTPDChannelTest.test_HELO_bad_syntaxcCs*|�d�|�d�|�|jjjd�dS)Nr/r�r�r!rrr�test_HELO_duplicate{s


�z$SMTPDChannelTest.test_HELO_duplicatecCs0d|_|�d�|�d�|�|jjjd�dS)NFr/s%MAIL from:<foo@example.com> SIZE=1234�"501 Syntax: MAIL FROM: <address>
)Z
extended_smtpr.rIr-rrpr!rrr�8test_HELO_parameter_rejected_when_extensions_not_enabled�s

�zISMTPDChannelTest.test_HELO_parameter_rejected_when_extensions_not_enabledcCs*|�d�|�d�|�|jjjd�dS)Nr/sMAIL from:   <foo@example.com>rtr�r!rrr�"test_MAIL_allows_space_after_colon�s


�z3SMTPDChannelTest.test_MAIL_allows_space_after_coloncCs*|�d�|�d�|�|jjjd�dS)NrDs&MAIL from:   <foo@example.com> size=20rtr�r!rrr�+test_extended_MAIL_allows_space_after_colon�s


�z<SMTPDChannelTest.test_extended_MAIL_allows_space_after_coloncCs |�d�|�|jjjd�dS)N�NOOPrtr�r!rrr�	test_NOOP�s
zSMTPDChannelTest.test_NOOPcCs*|�d�|�d�|�|jjjd�dS)Nr/r�rtr�r!rrr�test_HELO_NOOP�s

zSMTPDChannelTest.test_HELO_NOOPcCs |�d�|�|jjjd�dS)NsNOOP his501 Syntax: NOOP
r�r!rrr�test_NOOP_bad_syntax�s
�z%SMTPDChannelTest.test_NOOP_bad_syntaxcCs |�d�|�|jjjd�dS)N�QUIT�	221 Bye
r�r!rrr�	test_QUIT�s
zSMTPDChannelTest.test_QUITcCs*|�d�|�d�|�|jjjd�dS)Nr/r�r�r�r!rrr�test_HELO_QUIT�s

zSMTPDChannelTest.test_HELO_QUITcCs |�d�|�|jjjd�dS)NsQUIT bye byer�r�r!rrr�test_QUIT_arg_ignored�s
z&SMTPDChannelTest.test_QUIT_arg_ignoredcCs(d|j_|�d�|�|jjjd�dS)Nz	BAD STATEr/s451 Internal confusion
)r-Z
smtp_stater.rIrrpr!rrr�test_bad_state�s

�zSMTPDChannelTest.test_bad_statecCs:|�d�|�dd|jjd�|�|jjjd�dS)Nr/sMAIL from: �as@example�500 Error: line too long
)r.r-�command_size_limitrIrrpr!rrr�test_command_too_long�s

���z&SMTPDChannelTest.test_command_too_longcCsr|�d�|jjtd�}|�dd|d�|�|jjjd�|�dd|dd�|�|jjjd�dS)	NrDzMAIL from:<@example>�MAIL from:<r�s@example> SIZE=1234rt�r�)r.r-r��lenrIrrp�r�fill_lenrrr�*test_MAIL_command_limit_extended_with_SIZE�s 
��
���z;SMTPDChannelTest.test_MAIL_command_limit_extended_with_SIZEcCs2|�d�|�d�|�|jjjdd�d�dS)NrDs5MAIL from: <naive@example.com> BODY=8BITMIME SMTPUTF8r��5r�r!rrr�-test_MAIL_command_rejects_SMTPUTF8_by_default�s

�z>SMTPDChannelTest.test_MAIL_command_rejects_SMTPUTF8_by_defaultcCs\d|j_|�d�|�d�|�d�|�d�|�d|jjd�|�|jjjd�dS)	N�r/r0r1r2�AsA
.�552 Error: Too much mail data
�r-Zdata_size_limitr.rIrrpr!rrr�-test_data_longer_than_default_data_size_limit�s



��z>SMTPDChannelTest.test_data_longer_than_default_data_size_limitcCs*|�d�|�d�|�|jjjd�dS)NrDs!MAIL FROM:<eggs@example> SIZE=512rtr�r!rrr�test_MAIL_size_parameter�s


�z)SMTPDChannelTest.test_MAIL_size_parametercCs*|�d�|�d�|�|jjjd�dS)NrDs%MAIL FROM:<eggs@example> SIZE=invalid�9501 Syntax: MAIL FROM: <address> [SP <mail-parameters>]
r�r!rrr� test_MAIL_invalid_size_parameter�s


�z1SMTPDChannelTest.test_MAIL_invalid_size_parametercCsP|�d�|�d�|�|jjjd�|�d�|�d�|�|jjjd�dS)NrDs"MAIL FROM:<eggs@example> ham=greenrxsMAIL FROM:<eggs@example>s RCPT TO:<eggs@example> ham=greenrer�r!rrr�!test_MAIL_RCPT_unknown_parameters�s

�

�z2SMTPDChannelTest.test_MAIL_RCPT_unknown_parameterscCs2d|j_|�d�|�d�|�|jjjd�dS)Nr�rDs"MAIL FROM:<eggs@example> SIZE=2096s<552 Error: message size exceeds fixed maximum message size
r�r!rrr�<test_MAIL_size_parameter_larger_than_default_data_size_limit�s

�zMSMTPDChannelTest.test_MAIL_size_parameter_larger_than_default_data_size_limitcCs*|�d�|�d�|�|jjjd�dS)Nr/sRCPT to:spam@examples503 Error: need MAIL command
r�r!rrr�test_need_MAIL�s


�zSMTPDChannelTest.test_need_MAILcCs*|�d�|�d�|�|jjjd�dS)Nr/�MAIL from eggs@exampler�r�r!rrr�test_MAIL_syntax_HELOs


�z&SMTPDChannelTest.test_MAIL_syntax_HELOcCs*|�d�|�d�|�|jjjd�dS)NrDr�r�r�r!rrr�test_MAIL_syntax_EHLOs


�z&SMTPDChannelTest.test_MAIL_syntax_EHLOcCs*|�d�|�d�|�|jjjd�dS)Nr/s
MAIL from:r�r�r!rrr�test_MAIL_missing_address
s


�z*SMTPDChannelTest.test_MAIL_missing_addresscCs*|�d�|�d�|�|jjjd�dS)Nr/sMAIL from:<eggs@example>rtr�r!rrr�test_MAIL_chevronss

z#SMTPDChannelTest.test_MAIL_chevronscCs*|�d�|�d�|�|jjjd�dS)NrDsMAIL from:<>rtr�r!rrr�test_MAIL_empty_chevronss

z)SMTPDChannelTest.test_MAIL_empty_chevronscCs:|�d�|�d�|�|jjjd�|�|jjd�dS)NrDs%MAIL from: <"Fred Blogs"@example.com>rt�"Fred Blogs"@example.com�r.rIr-rrprr!rrr�test_MAIL_quoted_localparts

z+SMTPDChannelTest.test_MAIL_quoted_localpartcCs:|�d�|�d�|�|jjjd�|�|jjd�dS)NrDs#MAIL from: "Fred Blogs"@example.comrtr�r�r!rrr�$test_MAIL_quoted_localpart_no_angles#s

z5SMTPDChannelTest.test_MAIL_quoted_localpart_no_anglescCs:|�d�|�d�|�|jjjd�|�|jjd�dS)NrDs/MAIL from: <"Fred Blogs"@example.com> SIZE=1000rtr�r�r!rrr�$test_MAIL_quoted_localpart_with_size)s

z5SMTPDChannelTest.test_MAIL_quoted_localpart_with_sizecCs:|�d�|�d�|�|jjjd�|�|jjd�dS)NrDs-MAIL from: "Fred Blogs"@example.com SIZE=1000rtr�r�r!rrr�.test_MAIL_quoted_localpart_with_size_no_angles/s

z?SMTPDChannelTest.test_MAIL_quoted_localpart_with_size_no_anglescCs4|�d�|�d�|�d�|�|jjjd�dS)Nr/sMAIL from:eggs@examplesMAIL from:spam@examples 503 Error: nested MAIL command
r�r!rrr�test_nested_MAIL5s


�z!SMTPDChannelTest.test_nested_MAILcCs |�d�|�|jjjd�dS)NsVRFY eggs@examplesD252 Cannot VRFY user, but will accept message and attempt delivery
r�r!rrr�	test_VRFY<s
�zSMTPDChannelTest.test_VRFYcCs |�d�|�|jjjd�dS)NsVRFYs501 Syntax: VRFY <address>
r�r!rrr�test_VRFY_syntaxBs
�z!SMTPDChannelTest.test_VRFY_syntaxcCs |�d�|�|jjjd�dS)NsEXPNs502 EXPN not implemented
r�r!rrr�test_EXPN_not_implementedGs
�z*SMTPDChannelTest.test_EXPN_not_implementedcCs |�d�|�|jjjd�dS)NsMAIL from:<foo@example.com>�503 Error: send HELO first
r�r!rrr�test_no_HELO_MAILLs
�z"SMTPDChannelTest.test_no_HELO_MAILcCs4|�d�|�d�|�d�|�|jjjd�dS)Nr/r0r2s503 Error: need RCPT command
r�r!rrr�test_need_RCPTQs


�zSMTPDChannelTest.test_need_RCPTcCs4|�d�|�d�|�d�|�|jjjd�dS)Nr/�MAIL From: eggs@example�RCPT to eggs@examples 501 Syntax: RCPT TO: <address>
r�r!rrr�test_RCPT_syntax_HELOXs


�z&SMTPDChannelTest.test_RCPT_syntax_HELOcCs4|�d�|�d�|�d�|�|jjjd�dS)NrDr�r�s7501 Syntax: RCPT TO: <address> [SP <mail-parameters>]
r�r!rrr�test_RCPT_syntax_EHLO_s


�z&SMTPDChannelTest.test_RCPT_syntax_EHLOcCs4|�d�|�d�|�d�|�|jjjd�dS)Nr/r�sRCPT to: <eggs@example>rtr�r!rrr�test_RCPT_lowercase_to_OKfs


z*SMTPDChannelTest.test_RCPT_lowercase_to_OKcCs |�d�|�|jjjd�dS)Nr�r�r�r!rrr�test_no_HELO_RCPTls
�z"SMTPDChannelTest.test_no_HELO_RCPTcCs�|�d�|�d�|�|jjjd�|�d�|�|jjjd�|�d�|�|jjjd�|�d�|�|jjjd�|�|jjdd	d
gdfg�dS�Nr/r0rtr1r2�%354 End data with <CR><LF>.<CR><LF>
s
data
more
.�zpeer-addressz	peer-port�eggs@example�spam@examplez	data
more�r.rIr-rrpr8r	r!rrr�test_data_dialogqs$



�

��z!SMTPDChannelTest.test_data_dialogcCs>|�d�|�d�|�d�|�d�|�|jjjd�dS)Nr/r0r1�	DATA spams501 Syntax: DATA
r�r!rrr�test_DATA_syntax�s




z!SMTPDChannelTest.test_DATA_syntaxcCs |�d�|�|jjjd�dS)Nr�r�r�r!rrr�test_no_HELO_DATA�s
�z"SMTPDChannelTest.test_no_HELO_DATAcCsF|�d�|�d�|�d�|�d�|�d�|�|jjd�dS)Nr/r0r1r2s..
.
�.�r.rIr-�
received_datar!rrr�$test_data_transparency_section_4_5_2�s




z5SMTPDChannelTest.test_data_transparency_section_4_5_2cCs^|�d�|�d�|�d�|�d�|�d�|�d�|�|jjddd	d
gdfg�dS)Nr/r0r1sRCPT To:ham@exampler2�data
.r�r�r�zham@exampler)r.rIr8r	r!rrr�test_multiple_RCPT�s






��z#SMTPDChannelTest.test_multiple_RCPTcCsH|�d�|�d�|�d�|�d�|�d�|�|jjjd�dS)Nr/r0r1r2sreturn status
.s250 Okish
r�r!rrr�test_manual_status�s




z#SMTPDChannelTest.test_manual_statuscCs�|�d�|�d�|�d�|�d�|�|jjjd�|�d�|�d�|�d�|�d	�|�|jjd
ddgd
fg�dS)Nr/r0r1�RSETrtsMAIL From:foo@examplesRCPT To:eggs@exampler2r�r�zfoo@exampler�rr�r!rrr�	test_RSET�s 








��zSMTPDChannelTest.test_RSETcCs*|�d�|�d�|�|jjjd�dS)Nr/r�rtr�r!rrr�test_HELO_RSET�s

zSMTPDChannelTest.test_HELO_RSETcCs |�d�|�|jjjd�dS)NsRSET his501 Syntax: RSET
r�r!rrr�test_RSET_syntax�s
z!SMTPDChannelTest.test_RSET_syntaxcCs |�d�|�|jjjd�dS)NsUNKNOWN_CMDs1500 Error: command "UNKNOWN_CMD" not recognized
r�r!rrr�test_unknown_command�s
�z%SMTPDChannelTest.test_unknown_commandcCs�t�dtf��|jj}Wd�n1s,0Yt�dtf��d|j_Wd�n1sb0Yt�dtf��|jj}Wd�n1s�0Yt�dtf��d|j_Wd�n1s�0Yt�dtf��|jj}Wd�n1�s0Yt�dtf��d|j_Wd�n1�s>0Yt�dtf��|jj}Wd�n1�sv0Yt�dtf��d|j_Wd�n1�s�0Yt�dtf��|jj}Wd�n1�s�0Yt�dtf��d|j_Wd�n1�s0Yt�dtf��|jj	}Wd�n1�sV0Yt�dtf��d|j_	Wd�n1�s�0Yt�dtf��|jj
}Wd�n1�s�0Yt�dtf��d|j_
Wd�n1�s�0Yt�dtf��|jj}Wd�n1�s60Yt�dtf��d|j_Wd�n1�sn0Yt�dtf��|jj}Wd�n1�s�0Yt�dtf��d|j_Wd�n1�s�0Yt�dtf��|jj
}Wd�n1�s0Yt�dtf��d|j_
Wd�n1�sN0Yt�dtf��|jj}Wd�n1�s�0Yt�dtf��d|j_Wd�n1�s�0YdS)N��spam)rZcheck_warnings�DeprecationWarningr-Z_SMTPChannel__serverZ_SMTPChannel__lineZ_SMTPChannel__stateZ_SMTPChannel__greetingZ_SMTPChannel__mailfromZ_SMTPChannel__rcpttosZ_SMTPChannel__dataZ_SMTPChannel__fqdnZ_SMTPChannel__peerZ_SMTPChannel__connZ_SMTPChannel__addr)rr�rrr�test_attribute_deprecations�sX&&&&(((((((((((((((((z,SMTPDChannelTest.test_attribute_deprecationsN)Frrrr"rBr.r�r?r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�s�

	r�rWc@seZdZdd�ZdS)�SMTPDChannelIPv6TestcCsbtt_t_tj|_t��|_t_t	t
jdfddd�|_|j�
�\}}tj|j||dd�|_dSr�)rrrr rgrhrirjrkrrrYr8r4r5r-r�rrrr"�s��zSMTPDChannelIPv6Test.setUpN)rrrr"rrrrr��sr�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�!SMTPDChannelWithDataSizeLimitTestcCsdtt_t_tj|_t��|_t_t	t
jdfddd�|_|j�
�\}}tj|j||ddd�|_dS)Nrr#Tr%� r�r�rrrr"s��z'SMTPDChannelWithDataSizeLimitTest.setUpcCs t��tt_t_|jt_dSrrlr!rrrrBsz*SMTPDChannelWithDataSizeLimitTest.tearDowncCs|jj�|�|j��dSrr�r�rrrr.sz,SMTPDChannelWithDataSizeLimitTest.write_linecCs�|�d�|�d�|�|jjjd�|�d�|�|jjjd�|�d�|�|jjjd�|�d�|�|jjjd�|�|jjdd	d
gdfg�dSr�r�r!rrr�test_data_limit_dialogs$



�

��z8SMTPDChannelWithDataSizeLimitTest.test_data_limit_dialogcCs~|�d�|�d�|�|jjjd�|�d�|�|jjjd�|�d�|�|jjjd�|�d�|�|jjjd�dS)	Nr/r0rtr1r2r�s'This message is longer than 32 bytes
.r�r�r!rrr�$test_data_limit_dialog_too_much_data.s



�
�zFSMTPDChannelWithDataSizeLimitTest.test_data_limit_dialog_too_much_dataN)rrrr"rBr.r�r�rrrrr�s
r�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�SMTPDChannelWithDecodeDataFalsecCsZtt_t_tj|_t��|_t_t	t
jdfd�|_|j�
�\}}t�|j||�|_dS)Nrr#r�r�rrrr"?sz%SMTPDChannelWithDecodeDataFalse.setUpcCs t��tt_t_|jt_dSrrlr!rrrrBGsz(SMTPDChannelWithDecodeDataFalse.tearDowncCs|jj�|�|j��dSrr�r�rrrr.Lsz*SMTPDChannelWithDecodeDataFalse.write_linecCsP|�d�|�d�|�d�|�d�|�d�|�d�|�|jjd�dS)Nr/r0r1r2�plain ascii textrEr�r!rrr�test_ascii_dataPs





z/SMTPDChannelWithDecodeDataFalse.test_ascii_datacCsZ|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�|jjd�dS)	Nr/r0r1r2�utf8 enriched text: żźć�and some plain asciirEs/utf8 enriched text: żźć
and some plain asciir�r!rrr�test_utf8_dataYs






�z.SMTPDChannelWithDecodeDataFalse.test_utf8_dataN�rrrr"rBr.r�r�rrrrr�=s
	r�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�SMTPDChannelWithDecodeDataTruecCsbtt_t_tj|_t��|_t_t	t
jdfddd�|_|j�
�\}}tj|j||dd�|_dSr�r�r�rrrr"is��z$SMTPDChannelWithDecodeDataTrue.setUpcCs t��tt_t_|jt_dSrrlr!rrrrBtsz'SMTPDChannelWithDecodeDataTrue.tearDowncCs|jj�|�|j��dSrr�r�rrrr.ysz)SMTPDChannelWithDecodeDataTrue.write_linecCsP|�d�|�d�|�d�|�d�|�d�|�d�|�|jjd�dS)Nr/r0r1r2r�rEzplain ascii textr�r!rrrr�}s





z.SMTPDChannelWithDecodeDataTrue.test_ascii_datacCsZ|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�|jjd�dS)	Nr/r0r1r2r�r�rEu/utf8 enriched text: żźć
and some plain asciir�r!rrrr��s






�z-SMTPDChannelWithDecodeDataTrue.test_utf8_dataNrrrrrrgs
	rc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�&SMTPDChannelTestWithEnableSMTPUTF8TruecCsbtt_t_tj|_t��|_t_t	t
jdfddd�|_|j�
�\}}tj|j||dd�|_dS)Nrr#TrSr�r�rrrr"�s��z,SMTPDChannelTestWithEnableSMTPUTF8True.setUpcCs t��tt_t_|jt_dSrrlr!rrrrB�sz/SMTPDChannelTestWithEnableSMTPUTF8True.tearDowncCs|jj�|�|j��dSrr�r�rrrr.�sz1SMTPDChannelTestWithEnableSMTPUTF8True.write_linecCs0|�d�|�d�d��|�|jjjd�dS)NrDu7MAIL from: <naïve@example.com> BODY=8BITMIME SMTPUTF8�utf-8rt)r.r�rIr-rrpr!rrr�1test_MAIL_command_accepts_SMTPUTF8_when_announced�s
��zXSMTPDChannelTestWithEnableSMTPUTF8True.test_MAIL_command_accepts_SMTPUTF8_when_announcedcCs�|�d�dD]�}|�d|�|�|jjjdd�d�|�d�|�|jjjdd�d�|�d�|�|jjjdd�d	�|�d
�|dkr�|�|jjjd�q|�|jjjd
�qdS)NrD)r�sBODY=8BITMIME SMTPUTF8sMAIL from: <a@example> r��250srcpt to:<b@example.com>�data�354sc
.r�rts250 SMTPUTF8 message okish
r�)rZmail_parametersrrr�test_process_smtputf8_message�s



�zDSMTPDChannelTestWithEnableSMTPUTF8True.test_process_smtputf8_messagecCs�|�d�|�d�d��|�|jjjdd�d�|�d�d��|�|jjjdd�d�|�d�|�|jjjdd�d	�|�d
�|�d�|�|jjd
�dS)NrDu2MAIL From: naïve@examplé BODY=8BITMIME SMTPUTF8rrrruRCPT To:späm@examplér2rr�rE)r.r�rIr-rrpr�r!rrrr��s
�


�z5SMTPDChannelTestWithEnableSMTPUTF8True.test_utf8_datacCsn|�d�dtd�}|�dd|dd�|�|jjjd�|�dd|d�|�|jjjd	�dS)
N�ehlo example�$�mail from:<@example>r�r�r��	@example>r�rt�r.r�rIr-rrpr�rrr�7test_MAIL_command_limit_extended_with_SIZE_and_SMTPUTF8�s 

�����z^SMTPDChannelTestWithEnableSMTPUTF8True.test_MAIL_command_limit_extended_with_SIZE_and_SMTPUTF8cCs�|�d�dtd�}dD]�}|�d||d�|�|jjjdd�d	�|�d||d
�|�|jjjdd�d�|�d�|�|jjjdd�d�|�d
�|�|jjjdd�d�|�d�|�|jjjdd�d�qdS)Nr
rr)r��b�cr�s
a@example>rrs500r
rsrcpt to:<hans@example.com>rrstest
.r)rr��charrrr�1test_multiple_emails_with_extended_command_length�s



zXSMTPDChannelTestWithEnableSMTPUTF8True.test_multiple_emails_with_extended_command_lengthN)rrrr"rBr.rr	r�rrrrrrr�s

rc@seZdZdd�ZdS)�MiscTestCasecCshd�}tj|t|d�dS)N>	Z
COMMASPACE�usageZDevnullZprogramrgZOptionsZDATA_SIZE_DEFAULT�NEWLINEZ	parseargs)�	blacklist)rZcheck__all__r)rrrrr�test__all__�szMiscTestCase.test__all__N)rrrrrrrrr�sr�__main__)!rarJ�testrrZtest.supportrrrirr rr�	ExceptionrrZTestCaserrCrVrdrwr�rbrcr�r�r�rrrr�mainrrrr�<module>s8"]%B`7*,X



Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists