diff options
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, |