summaryrefslogtreecommitdiff
path: root/service/test/unit
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2015-09-01 11:13:09 +0200
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-09-01 11:20:33 +0200
commit722edf3a306e495808c3ca751f6c74f5d6e5b138 (patch)
treef5a6b75f04c32ee87130608f0a4af0e330401e86 /service/test/unit
parent5c5500f91a520ee363c8e553718a5a0e763257e5 (diff)
Encode headers in InputMail when generating mime multipart from it.
- Issue #360
Diffstat (limited to 'service/test/unit')
-rw-r--r--service/test/unit/adapter/test_mail.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/service/test/unit/adapter/test_mail.py b/service/test/unit/adapter/test_mail.py
index d30e2485..03a37c1f 100644
--- a/service/test/unit/adapter/test_mail.py
+++ b/service/test/unit/adapter/test_mail.py
@@ -465,6 +465,16 @@ class InputMailTest(unittest.TestCase):
self.assertRegexpMatches(mime_multipart.as_string(), "\nSubject: Oi\n")
self.assertRegexpMatches(mime_multipart.as_string(), base64.b64encode(simple_mail_dict()['body']))
+ def test_to_mime_multipart_with_special_chars(self):
+ mail_dict = simple_mail_dict()
+ mail_dict['header']['to'] = u'"Älbert Übrö \xF0\x9F\x92\xA9" <äüö@example.mail>'
+ pixelated.support.date.iso_now = lambda: 'date now'
+
+ mime_multipart = InputMail.from_dict(mail_dict).to_mime_multipart()
+
+ expected_part_of_encoded_to = 'Iiwgw4QsIGwsIGIsIGUsIHIsIHQsICAsIMOcLCBiLCByLCDDtiwgICwgw7As'
+ self.assertRegexpMatches(mime_multipart.as_string(), expected_part_of_encoded_to)
+
def test_smtp_format(self):
InputMail.FROM_EMAIL_ADDRESS = 'pixelated@org'