diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-01-13 15:23:03 +0100 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-01-13 15:24:00 +0100 |
commit | 61971193bbaf7c7572a07cbb08add0c04be5ad55 (patch) | |
tree | d8953cf0890d2f5ae1cb9db126c0f8e3f5eb2d2d /service/test/unit/adapter | |
parent | 6f6f8a338ec460aea761de320aaccc25b0eb2d42 (diff) |
Fixed ignoring charset on mail content type when parsing mails.
Diffstat (limited to 'service/test/unit/adapter')
-rw-r--r-- | service/test/unit/adapter/mail_test.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/service/test/unit/adapter/mail_test.py b/service/test/unit/adapter/mail_test.py index 9dc54e66..be7b731d 100644 --- a/service/test/unit/adapter/mail_test.py +++ b/service/test/unit/adapter/mail_test.py @@ -171,6 +171,17 @@ class TestPixelatedMail(unittest.TestCase): self.assertRegexpMatches(mail.text_plain_body, '([\s\S]*100%)') self.assertRegexpMatches(mail.html_body, '([\s\S]*100%)') + def test_content_type_header_of_mail_part_is_used(self): + plain_headers = {'Content-Type': 'text/plain; charset=utf-8', 'Content-Transfer-Encoding': 'quoted-printable'} + html_headers = {'Content-Type': 'text/html; charset=utf-8', 'Content-Transfer-Encoding': 'quoted-printable'} + parts = {'alternatives': [{'content': 'H=C3=A4llo', 'headers': plain_headers}, {'content': '<p>H=C3=A4llo</p>', 'headers': html_headers}]} + + mail = PixelatedMail.from_soledad(None, None, self._create_bdoc(raw='some raw body'), parts=parts, soledad_querier=None) + + self.assertEqual(2, len(mail.alternatives)) + self.assertEquals(u'H\xe4llo', mail.text_plain_body) + self.assertEquals(u'<p>H\xe4llo</p>', mail.html_body) + def test_clean_line_breaks_on_address_headers(self): many_recipients = 'One <one@mail.com>,\nTwo <two@mail.com>, Normal <normal@mail.com>,\nalone@mail.com' headers = {'Cc': many_recipients, |