HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/test_email/__pycache__/test_message.cpython-310.opt-2.pyc
o

�iP��@s�ddlZddlZddlmZmZddlmZmZddlm	Z	m
Z
dd�ZGdd�de	�Ze
Gd	d
�d
��Z
Gdd�de
e	�ZGd
d�de
e	�ZedkrQe��dSdS)�N)�policy�message_from_string)�EmailMessage�MIMEPart)�
TestEmailBase�parameterizecCsttdd�|�d�S)NcSs|duS�N�)�xr	r	�9/usr/local/lib/python3.10/test/test_email/test_message.py�<lambda>
szfirst.<locals>.<lambda>)�next�filter)�iterabler	r	r�first	src@s"eZdZejZdd�Zdd�ZdS)�TestcCsJ|�d�}d|d<|�t��
d|d<Wd�dS1swYdS)N�zabc@xyz�Tozxyz@abc)�_str_msg�assertRaises�
ValueError��self�mr	r	r�+test_error_on_setitem_if_max_count_exceededs


"�z0Test.test_error_on_setitem_if_max_count_exceededcCsDtt�d�tjd�}|�|dd�|�|dd�|�|t�dS)Na>            Subject: Ayons asperges pour le =?utf-8?q?d=C3=A9jeuner?=
            From: =?utf-8?q?Pep=C3=A9?= Le Pew <pepe@example.com>
            To: "Penelope Pussycat" <"penelope@example.com">
            MIME-Version: 1.0
            Content-Type: text/plain; charset="utf-8"

            sample text
            �r�subjectu Ayons asperges pour le déjeuner�fromuPepé Le Pew <pepe@example.com>)r�textwrap�dedentr�default�assertEqualZassertIsInstancerrr	r	r�/test_rfc2043_auto_decoded_and_emailmessage_useds
�	z4Test.test_rfc2043_auto_decoded_and_emailmessage_usedN)�__name__�
__module__�__qualname__rr rr"r	r	r	rr
src@s�eZdZejZdddde�d�fddde�d�fddde�d	�fddde�d
�fddde�d
�fddde�d�fddde�d�fddde�d�fddde�d�fddde�d�fddde�d�fddde�d�fddde�d�fddde�d�fd �Zd!d"�Zd#d$�Z	d%d&�Z
Gd'd(�d(�Zd)d*�Zd+d,�Z
d-d.�Zd/d0�Zd1Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�ZGd>d?�d?�Zd@dA�ZGdBdC�dC�ZdDdE�ZdFdG�ZdHdI�ZdJdK�ZdLdM�ZdNS)O�TestEmailMessageBase)�NNrr	r	rr'r	zV                To: foo@example.com

                simple text body
                )NNNz�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: image/jpg

                bogus body.
                )N��)r)r(a�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/alternative; boundary="==="

                preamble

                --===
                Content-Type: text/plain

                simple body

                --===
                Content-Type: text/html

                <p>simple body</p>
                --===--
                a�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/mixed; boundary="==="

                preamble

                --===
                Content-Type: text/plain

                simple body

                --===
                Content-Type: text/html

                <p>simple body</p>

                --===--
                )NNr))r(a�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/mixed; boundary="==="

                --===
                Content-Type: text/plain

                simple body

                --===
                Content-Type: text/html
                Content-Disposition: attachment

                <p>simple body</p>

                --===--
                )Nr(N)r)a�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/mixed; boundary="==="

                --===
                Content-Type: text/plain
                Content-Disposition: AtTaChment

                simple body

                --===
                Content-Type: text/html

                <p>simple body</p>

                --===--
                a�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/mixed; boundary="==="

                --===
                Content-Type: text/plain
                Content-Disposition: InLine

                simple body

                --===
                Content-Type: text/html
                Content-Disposition: inline

                <p>simple body</p>

                --===--
                )rr)Na�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/related; boundary="==="; type=text/html

                --===
                Content-Type: text/html

                <p>simple body</p>

                --===
                Content-Type: image/jpg
                Content-ID: <image1>

                bogus data

                --===--
                )rr(Na                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/related; boundary="==="; type=text/html;
                 start="<body>"

                --===
                Content-Type: text/html
                Content-ID: <include>

                useless text

                --===
                Content-Type: text/html
                Content-ID: <body>

                <p>simple body</p>
                <!--#include file="<include>"-->

                --===--
                )��r()��)r)r,r-a�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/mixed; boundary="==="

                --===
                Content-Type: multipart/alternative; boundary="+++"

                --+++
                Content-Type: text/plain

                simple body

                --+++
                Content-Type: multipart/related; boundary="___"

                --___
                Content-Type: text/html

                <p>simple body</p>

                --___
                Content-Type: image/jpg
                Content-ID: <image1@cid>

                bogus jpg body

                --___--

                --+++--

                --===
                Content-Type: image/jpg
                Content-Disposition: attachment

                bogus jpg body

                --===
                Content-Type: image/jpg
                Content-Disposition: AttacHmenT

                another bogus jpg body

                --===--
                )r)r+r*a�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/mixed; boundary="==="

                --===
                Content-Type: multipart/related; boundary="+++"

                --+++
                Content-Type: multipart/alternative; boundary="___"

                --___
                Content-Type: text/plain

                simple body

                --___
                Content-Type: text/html

                <p>simple body</p>

                --___--

                --+++
                Content-Type: image/jpg
                Content-ID: <image1@cid>

                bogus jpg body

                --+++--

                --===
                Content-Type: image/jpg
                Content-Disposition: attachment

                bogus jpg body

                --===
                Content-Type: image/jpg
                Content-Disposition: attachment

                another bogus jpg body

                --===--
                )r)NNa�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/mixed; boundary="==="

                --===
                Content-Type: multipart/related; boundary="+++"

                --+++
                Content-Type: image/jpg
                Content-ID: <image1@cid>

                bogus jpg body

                --+++
                Content-Type: multipart/alternative; boundary="___"

                --___
                Content-Type: text/plain

                simple body

                --___
                Content-Type: text/html

                <p>simple body</p>

                --___--

                --+++--

                --===
                Content-Type: image/jpg
                Content-Disposition: attachment

                bogus jpg body

                --===
                Content-Type: image/jpg
                Content-Disposition: attachment

                another bogus jpg body

                --===--
                z�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: message/rfc822

                To: bar@example.com
                From: robot@examp.com

                this is a message body.
                a�                To: foo@example.com
                MIME-Version: 1.0
                Content-Type: multipart/mixed; boundary="==="

                --===
                Content-Type: text/plain

                Your message has bounced, sir.

                --===
                Content-Type: message/rfc822

                To: bar@example.com
                From: robot@examp.com

                this is a message body.

                --===--
                )Z
empty_messageZnon_mime_plainZ
mime_non_textZplain_html_alternativeZplain_html_mixedZplain_html_attachment_mixedZhtml_text_attachment_mixedZ!html_text_attachment_inline_mixed�relatedZrelated_with_startZmixed_alternative_plain_relatedZ$mixed_related_alternative_plain_htmlZ0mixed_related_alternative_plain_html_wrong_orderZmessage_rfc822Zmixed_text_message_rfc822c
s�|�|�}t|�����fdd�|D�}d}d}d}	|�|��t|��|�|jdd�t|��|�|jdd�t|||d���|�|jd	d�t||||	g��|�|jd
d�t|||	d���|�|jdgd�||�|�|jdgd�||�|�|jd
gd�||	�|�|jdd�t||	|dd���|�|jdd�t||	||g��|�|jdd�t||dd���|�|jdd�t|ddd���|�|jdd�t||||	||g��dS)Ncs g|]}|dur
dn�|�qSrr	��.0�n�Zallpartsr	r�
<listcomp>�s z<TestEmailMessageBase.message_as_get_body.<locals>.<listcomp>rr)r()r.�html�plain)Zpreferencelist)r.r4)r.r5)r4r5r.r4r5)r5r4���)r5r.)r4r.)r5r4r.)r4r5r.)r�list�walkr!�get_bodyr)
r�
body_parts�attachments�parts�msgrZexpectedr.r4r5r	r2r�message_as_get_body�sP
�����������z(TestEmailMessageBase.message_as_get_bodycs@|�|�}t|�����fdd�|D�}|�t|���|�dS)Nc�g|]}�|�qSr	r	r/r2r	rr3��zCTestEmailMessageBase.message_as_iter_attachment.<locals>.<listcomp>)rr7r8r!�iter_attachments�rr:r;r<r=rr	r2r�message_as_iter_attachment�s
z/TestEmailMessageBase.message_as_iter_attachmentcsXdd�}|�|�}t|�����fdd�|D�}||�r"t|���ng}|�||�dS)NcSsd|vS)NzContent-Type: multipartr	)r=r	r	r�_is_multipart_msg��zETestEmailMessageBase.message_as_iter_parts.<locals>._is_multipart_msgcr?r	r	r/r2r	rr3�r@z>TestEmailMessageBase.message_as_iter_parts.<locals>.<listcomp>)rr7r8�
iter_partsr!)rr:r;r<r=rDrrFr	r2r�message_as_iter_parts�s
z*TestEmailMessageBase.message_as_iter_partsc@seZdZdd�Zdd�ZdS)z(TestEmailMessageBase._TestContentManagercOs
|||fSrr	�rr=�args�kwr	r	r�get_content�s
z4TestEmailMessageBase._TestContentManager.get_contentcOs||_||_||_dSr)r=rIrJrHr	r	r�set_content�s
z4TestEmailMessageBase._TestContentManager.set_contentN)r#r$r%rKrLr	r	r	r�_TestContentManager�srMcCst|�d�}|��}|�|j|d�|dif�|jd|ddd�\}}}|�||�|�|d�|�|tddd	��dS�
Nr��content_managerr	�foor)r()rP�bar�k�rQ�rRrS)rrMr!rK�dict)rr�cmr=rIrJr	r	r�test_get_content_with_cm�s
z-TestEmailMessageBase.test_get_content_with_cmcCs|tjj|��d�}|jd|d�}|�|��|dif�|jdddd�\}}}|�||�|�|d	�|�|tddd��dS�
NrOrrr	rQr)r(rUrT)rr �clonerMrr!rKrV)r�prr=rIrJr	r	r�-test_get_content_default_cm_comes_from_policyszBTestEmailMessageBase.test_get_content_default_cm_comes_from_policycCs�|�d�}|��}|j|d�|�|j|�|�|jd�|�|ji�|jd|ddd�|�|j|�|�|jd�|�|jtddd	��dSrN)rrMrLr!r=rIrJrV�rrrWr	r	r�test_set_content_with_cm
s
z-TestEmailMessageBase.test_set_content_with_cmcCs�|��}tjj|d�}|jd|d�}|��|�|j|�|�|jd�|�|j	i�|jdddd�|�|j|�|�|jd	�|�|j	t
ddd��dSrY)rMrr rZrrLr!r=rIrJrV)rrWr[rr	r	r�-test_set_content_default_cm_comes_from_policyszBTestEmailMessageBase.test_set_content_default_cm_comes_from_policy))r.�
no_content�succeeds)r.�nonera)r.r5ra)r.r.r)r.�alternative�raises)r.�mixedrd)rcr`ra)rcrbra)rcr5ra)rcr.ra)rcrcr)rcrerd)rer`ra)rerbra)rer5ra)rer.ra)rercra)rerercCs�|��}d}ddg}|dkr	|�d�|dkr%d}|�d�|�d�n|dkr4g}|�dd	|f�|�d
�|�|�|D]\}}|||<q@|||fS)N)rzfoo@bar.com)ZFromzbar@foo.comr`)zX-Random-HeaderZCorwin�textr)�Content-Type�
text/plainrg�
multipart/)zX-Trump�Random)�message�append�set_payload)r�subtyper�payload�msg_headers�name�valuer	r	r�_make_subtype_test_messageAs(�





z/TestEmailMessageBase._make_subtype_test_messagecCs\|�t��}t||��Wd�n1swYt|j�}|�||�|�||�dSr)rr�getattr�str�	exceptionZassertIn)rrZmethod_namern�method�ar�exc_textr	r	r� _check_disallowed_subtype_raisesXs�
z5TestEmailMessageBase._check_disallowed_subtype_raisescCs�d}|D]\}}|���d�s|�|||�|d7}q|�t|�|d�t|���}d}|D]\}}|���d�rG|�|||�|d7}q0|�t|�|�|�|��|�dS)Nr�content-r))�lower�
startswithr!�lenr
rF�get_payload)rrrpro�countrqrr�partr	r	r�_check_make_multipart_s ��z*TestEmailMessageBase._check_make_multipartcCs�|�|�\}}}d|}|dvr|�||||�dSt||��|�|��d�|�|��|�|dkrO|�t|���d�|�|��|dd|fg�dS|�t|���d�|�	|||�dS)	N�make_�rrd�	multipartr`rrgrir))
rsrzrtr!�get_content_maintype�get_content_subtyper~r�itemsr�)rrwrn�outcomerrproZmake_methodr	r	r�subtype_as_makeos"
��z$TestEmailMessageBase.subtype_as_makecCs�|��}|dvr.d||d<|�t��}t|d|��Wd�dS1s'wYdS|dkr7d|d<n
|dkrAd||d<t|d|�dd	�|�|���|�|��d�dS)
Nr�rirgr�r5rhr`�abc)�boundary)rkrrrt�
assertTrueZis_multipartr!Zget_boundary)rrwrnr�rrWr	r	r�subtype_as_make_with_boundary�s 
��
z2TestEmailMessageBase.subtype_as_make_with_boundarycCsNdD]"}|j|jjdd�d�}d|d<t||��|�|�d�jjd�qdS)N)Zmake_relatedZmake_alternativeZ
make_mixedrQrOrrhrgr)rkrrZrtr!rrP)rrwrr	r	r�3test_policy_on_part_made_by_make_comes_from_message�s�zHTestEmailMessageBase.test_policy_on_part_made_by_make_comes_from_messagec@�eZdZdd�ZdS)z+TestEmailMessageBase._TestSetContentManagercOsd|d<|�|�dS)Nrhrg)rm�rr=ZcontentrIrJr	r	rrL�sz7TestEmailMessageBase._TestSetContentManager.set_contentN�r#r$r%rLr	r	r	r�_TestSetContentManager��r�cCsb|�|�\}}}|��}|dkrdnd|}|dkr$|�||||�dSt||�d|d�|�|��d�|�|��|�||ksE|dkre|�t|���d	�|D]\}	}
|�||	|
�qQ|��d
}n|�t|���d�|�	|||�|��d	}|�|�
�d�|�|��d�|dkr�|�|d
d�dS|dkr�|�|d
d�dS|�|d
�dS)Nre�add_attachmentZadd_rd�testrOr�r`r)rr(rh�Content-Disposition�
attachmentr.�inline)rsr�rzrtr!r�r�r~rr�Zget_content_type�assertIsNone)rrwrnr�rrprorWZ
add_methodrqrrr�r	r	r�subtype_as_add�s0z#TestEmailMessageBase.subtype_as_addc@r�)z2TestEmailMessageBase._TestSetRaisingContentManagercOstd��)Nr�)�	Exceptionr�r	r	rrL�rEz>TestEmailMessageBase._TestSetRaisingContentManager.set_contentNr�r	r	r	r�_TestSetRaisingContentManager�r�r�c	Csv|��}|j|jj|d�d�}dD]'}|�t��}t||�d�Wd�n1s*wY|�t|j	�d�qdS)NrOr)�add_relatedZadd_alternativer�rr�)
r�rkrrZrr�rtr!rurv)rrWrrwrxr	r	r�6test_default_content_manager_for_add_comes_from_policy�s��zKTestEmailMessageBase.test_default_content_manager_for_add_comes_from_policycCs\|�|�}|��|�t|�d�|�t|���g�|�|���|�t|���g�dS)Nr)	r�clearr!r~r7r�r�rrFrBr	r	r�message_as_clear�s
z%TestEmailMessageBase.message_as_clearcCs^|�|�}dd�|��D�}|��|�t|���|�|�|���|�t|���g�dS)NcSsg|]}|���d�s|�qS)r{)r|r})r0�hr	r	rr3�s
�zATestEmailMessageBase.message_as_clear_content.<locals>.<listcomp>)r�keysZ
clear_contentr!r7r�rrF)rr:r;r<r=rZexpected_headersr	r	r�message_as_clear_content�s
z-TestEmailMessageBase.message_as_clear_contentcCs�|��}|�|���d|d<|�|���|�dd�|�|���|�dd�|�|���|�ddd�|�|���dS)Nr�r�r�Z
AtTachMent�filenamezabc.png)�
_make_messageZassertFalseZ
is_attachmentZreplace_headerr�Z	set_paramrr	r	r�test_is_attachment�sz'TestEmailMessageBase.test_is_attachmentcCs^|��}|�d�|�d�|�d�|����}|�tt|����d�|�|��|�dS)Nzarbitrary text as main partzmore text as a related partz&yet more text as a second "attachment"r()	r�rLr�r�copyr!r~r7rA)rrZorigr	r	r�test_iter_attachments_mutation�s


z3TestEmailMessageBase.test_iter_attachments_mutationN)r#r$r%rr rrZmessage_paramsr>rCrGrMrXr\r^r_Zsubtype_paramsrsrzr�r�r�r�r�r�r�r�r�r�r�r�r	r	r	rr&&s���
��������5�6�3����� 
			r&c@s�eZdZeZdd�ZGdd�d�Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#S)$�TestEmailMessagecC�>|�d�}|��}|�d|�|j|d�|�|dd�dS�Nr�MIME-VersionrO�1.0)rrM�assertNotInrLr!r]r	r	r�"test_set_content_adds_MIME_Version��

z3TestEmailMessage.test_set_content_adds_MIME_Versionc@r�)z(TestEmailMessage._MIME_Version_adding_CMcOsd|d<dS)Nr�r�r	rHr	r	rrL�sz4TestEmailMessage._MIME_Version_adding_CM.set_contentNr�r	r	r	r�_MIME_Version_adding_CM�r�r�cCr�r�)rr�r�rLr!r]r	r	r�0test_set_content_does_not_duplicate_MIME_Version�r�zATestEmailMessage.test_set_content_does_not_duplicate_MIME_VersioncCs*|�d�}|�t|�������d�dS�N��Subject: long line ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab

r*�rr!r~�	as_string�strip�
splitlinesrr	r	r�0test_as_string_uses_max_header_length_by_default�
 zATestEmailMessage.test_as_string_uses_max_header_length_by_defaultcCsN|�d�}|�t|jdd������d�|�t|jdd������d�dS)Nr�r)Zmaxheaderlenr)�"r,r�rr	r	r�"test_as_string_allows_maxheaderlens
��z3TestEmailMessage.test_as_string_allows_maxheaderlencCs@|�d�}|�d�|�|jdd�d�|�|jdd�d�dS)Nr�z%From foo@bar Thu Jan  1 00:00:00 1970T)Zunixfromz+From foo@bar Thu Jan  1 00:00:00 1970

testFz
test)rZset_unixfromr!r�rr	r	r�test_as_string_unixforms

�z(TestEmailMessage.test_as_string_unixformcCs*|�d�}|�tt|������d�dSr�)rr!r~rur�r�rr	r	r�+test_str_defaults_to_policy_max_line_lengthr�z<TestEmailMessage.test_str_defaults_to_policy_max_line_lengthcC�"t�}d|d<|�t|�d�dS)Nuunicöde�SubjectuSubject: unicöde

)rr!rurr	r	r�test_str_defaults_to_utf8sz*TestEmailMessage.test_str_defaults_to_utf8cCr�)NuDHello Wörld! Hello Wörld! Hello Wörld! Hello Wörld!Hello Wörld!r�s|Subject: Hello =?utf-8?q?W=C3=B6rld!_Hello_W=C3=B6rld!_Hello_W=C3=B6rld!?=
 Hello =?utf-8?q?W=C3=B6rld!Hello_W=C3=B6rld!?=

�rr!�bytesrr	r	r�!test_folding_with_utf8_encoding_1�

�z2TestEmailMessage.test_folding_with_utf8_encoding_1cCr�)NuHHello Wörld! Hello Wörld! Hello Wörlds123! Hello Wörld!Hello Wörld!r�s�Subject: Hello =?utf-8?q?W=C3=B6rld!_Hello_W=C3=B6rld!_Hello_W=C3=B6rlds123!?=
 Hello =?utf-8?q?W=C3=B6rld!Hello_W=C3=B6rld!?=

r�rr	r	r�!test_folding_with_utf8_encoding_2/r�z2TestEmailMessage.test_folding_with_utf8_encoding_2cCr�)NuHHello-Wörld!-Hello-Wörld!-Hello-Wörlds123! Hello Wörld!Hello Wörld!r�s�Subject: =?utf-8?q?Hello-W=C3=B6rld!-Hello-W=C3=B6rld!-Hello-W=C3=B6rlds123!?=
 Hello =?utf-8?q?W=C3=B6rld!Hello_W=C3=B6rld!?=

r�rr	r	r�!test_folding_with_utf8_encoding_3?r�z2TestEmailMessage.test_folding_with_utf8_encoding_3cCr�)NuHHello-Wörld!-Hello-Wörld!-Hello-Wörlds123!-Hello Wörld!Hello Wörld!r�s�Subject: =?utf-8?q?Hello-W=C3=B6rld!-Hello-W=C3=B6rld!-Hello-W=C3=B6rlds123!?=
 =?utf-8?q?-Hello_W=C3=B6rld!Hello_W=C3=B6rld!?=

r�rr	r	r�!test_folding_with_utf8_encoding_4Or�z2TestEmailMessage.test_folding_with_utf8_encoding_4cCr�)NuS123456789 123456789 123456789 123456789 123456789 123456789 123456789 Hello Wörld!r�soSubject: 123456789 123456789 123456789 123456789 123456789 123456789 123456789
 Hello =?utf-8?q?W=C3=B6rld!?=

r�rr	r	r�!test_folding_with_utf8_encoding_5_s

�z2TestEmailMessage.test_folding_with_utf8_encoding_5cCr�)Nuq123456789 123456789 123456789 123456789 Hello Wörld! 123456789 123456789 123456789 123456789 123456789 123456789r�s�Subject: 123456789 123456789 123456789 123456789 Hello =?utf-8?q?W=C3=B6rld!?=
 123456789 123456789 123456789 123456789 123456789 123456789

r�rr	r	r�!test_folding_with_utf8_encoding_6ms

�z2TestEmailMessage.test_folding_with_utf8_encoding_6cCr�)Nuo123456789 123456789 Hello Wörld! Hello Wörld! 123456789-123456789 123456789 Hello Wörld! 123456789 123456789r�s�Subject: 123456789 123456789 Hello =?utf-8?q?W=C3=B6rld!_Hello_W=C3=B6rld!?=
 123456789-123456789 123456789 Hello =?utf-8?q?W=C3=B6rld!?= 123456789
 123456789

r�rr	r	r�!test_folding_with_utf8_encoding_7}s

�z2TestEmailMessage.test_folding_with_utf8_encoding_7cCr�)Nu�123456789 123456789 Hello Wörld! Hello Wörld! 123456789 123456789 123456789 123456789 123456789 123456789-123456789 123456789 Hello Wörld! 123456789 123456789r�s�Subject: 123456789 123456789 Hello =?utf-8?q?W=C3=B6rld!_Hello_W=C3=B6rld!?=
 123456789 123456789 123456789 123456789 123456789 123456789-123456789
 123456789 Hello =?utf-8?q?W=C3=B6rld!?= 123456789 123456789

r�rr	r	r�!test_folding_with_utf8_encoding_8�s

�z2TestEmailMessage.test_folding_with_utf8_encoding_8cCs"	t�d�}|�|�}|��dS)Na'            Message-ID: <674392CA.4347091@email.au>
            Date: Wed, 08 Nov 2017 08:50:22 +0700
            From: Foo Bar <email@email.au>
            MIME-Version: 1.0
            To: email@email.com <email@email.com>
            Subject: Python Email
            Content-Type: multipart/mixed;
            boundary="------------879045806563892972123996"
            X-Global-filter:Messagescannedforspamandviruses:passedalltests

            This is a multi-part message in MIME format.
            --------------879045806563892972123996
            Content-Type: text/plain; charset=ISO-8859-1; format=flowed
            Content-Transfer-Encoding: 7bit

            Your message is ready to be sent with the following file or link
            attachments:
            XU89 - 08.11.2017
            )rrrr9)rr=rr	r	r�test_get_body_malformed�s

z(TestEmailMessage.test_get_body_malformedN)r#r$r%rrkr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r	r	r	rr��s&r�c@s eZdZeZdd�Zdd�ZdS)�TestMIMEPartcCs:|�d�}|��}|�d|�|j|d�|�d|�dS)Nrr�rO)rrMr�rLr]r	r	r�*test_set_content_does_not_add_MIME_Version�s

z7TestMIMEPart.test_set_content_does_not_add_MIME_VersioncCs0tt�d�tjd�}|��}|�t|�g�dS)NzT        Content-Type: multipart/mixed; charset="utf-8"

        sample text
        r)rrrrr rAr!r7)rr=r;r	r	r�/test_string_payload_with_multipart_content_type�s

�z<TestMIMEPart.test_string_payload_with_multipart_content_typeN)r#r$r%rrkr�r�r	r	r	rr��sr��__main__)ZunittestrZemailrrZ
email.messagerrZtest.test_emailrrrrr&r�r�r#�mainr	r	r	r�<module>s(LQ�