Test for space continuation character in long (ascii) subject headers (#7747)
"""
email=EmailMessage('Long subject lines that get wrapped should use a space continuation character to get expected behavior in Outlook and Thunderbird','Content','from@example.com',['to@example.com'])
email=EmailMessage('Long subject lines that get wrapped should contain a space continuation character to get expected behavior in Outlook and Thunderbird','Content','from@example.com',['to@example.com'])
message=email.message()
self.assertEqual(message['Subject'],'Long subject lines that get wrapped should use a space continuation\n character to get expected behavior in Outlook and Thunderbird')
# Note that in Python 3, maximum line length has increased from 76 to 78
self.assertEqual(message['Subject'].encode(),b'Long subject lines that get wrapped should contain a space continuation\n character to get expected behavior in Outlook and Thunderbird')
deftest_message_header_overrides(self):
"""
...
...
@@ -88,7 +89,7 @@ class MailTests(TestCase):
"""
headers={"date":"Fri, 09 Nov 2001 01:08:47 -0000","Message-ID":"foo"}
self.assertEqual(msg.message().get_payload(0).as_string(),b'Content-Type: text/plain; charset="iso-8859-1"\nMIME-Version: 1.0\nContent-Transfer-Encoding: quoted-printable\n\nFirstname S=FCrname is a great guy.')
self.assertEqual(msg.message().get_payload(1).as_string(),b'Content-Type: text/html; charset="iso-8859-1"\nMIME-Version: 1.0\nContent-Transfer-Encoding: quoted-printable\n\n<p>Firstname S=FCrname is a <strong>great</strong> guy.</p>')
self.assertEqual(msg.message().get_payload(0).as_string(),'Content-Type: text/plain; charset="iso-8859-1"\nMIME-Version: 1.0\nContent-Transfer-Encoding: quoted-printable\n\nFirstname S=FCrname is a great guy.')
self.assertEqual(msg.message().get_payload(1).as_string(),'Content-Type: text/html; charset="iso-8859-1"\nMIME-Version: 1.0\nContent-Transfer-Encoding: quoted-printable\n\n<p>Firstname S=FCrname is a <strong>great</strong> guy.</p>')
deftest_attachments(self):
"""Regression test for #9367"""
...
...
@@ -291,31 +292,31 @@ class MailTests(TestCase):
# Regression for #13433 - Make sure that EmailMessage doesn't mangle
# 'From ' in message body.
email=EmailMessage('Subject','From the future','bounce@example.com',['to@example.com'],headers={'From':'from@example.com'})
self.assertFalse(b'>From the future'inemail.message().as_string())
self.assertFalse('>From the future'inemail.message().as_string())
msg=EmailMessage('Subject','Body with non latin characters: А Б В Г Д Е Ж Ѕ З И І К Л М Н О П.','bounce@example.com',['to@example.com'],headers={'From':'from@example.com'})