diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-09-01 14:00:21 +0200 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-09-01 14:00:21 +0200 |
commit | a43f3a7c9c47dc9c9239414a0eba9bbc1f3cfdbf (patch) | |
tree | 919ad8a3679e0d81f6c53d32456a199cd4b355dc /service/test/unit/adapter | |
parent | 722edf3a306e495808c3ca751f6c74f5d6e5b138 (diff) |
Encode mail addresses when replying
- Issue #448
Diffstat (limited to 'service/test/unit/adapter')
-rw-r--r-- | service/test/unit/adapter/mailstore/test_leap_mail.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/service/test/unit/adapter/mailstore/test_leap_mail.py b/service/test/unit/adapter/mailstore/test_leap_mail.py index 9dab4e28..9b72d8c3 100644 --- a/service/test/unit/adapter/mailstore/test_leap_mail.py +++ b/service/test/unit/adapter/mailstore/test_leap_mail.py @@ -48,7 +48,7 @@ class TestLeapMail(TestCase): def test_as_dict(self): mail = LeapMail('doc id', 'INBOX', {'From': 'test@example.test', 'Subject': 'A test Mail', 'To': 'receiver@example.test,receiver2@other.test'}, ('foo', 'bar')) - + self.maxDiff = None expected = { 'header': { 'from': 'test@example.test', @@ -64,8 +64,8 @@ class TestLeapMail(TestCase): 'textPlainBody': None, 'replying': {'all': {'cc-field': [], 'to-field': ['receiver@example.test', - 'receiver2@other.test', - 'test@example.test']}, + 'test@example.test', + 'receiver2@other.test']}, 'single': 'test@example.test'}, 'attachments': [] } @@ -98,6 +98,18 @@ class TestLeapMail(TestCase): self.assertEqual([expected_address], mail.as_dict()['header']['cc']) self.assertEqual(expected_subject, mail.as_dict()['header']['subject']) + def test_as_dict_replying_with_special_chars(self): + expected_address = u'"\xc4lbert \xdcbr\xf6" <\xe4\xfc\xf6@example.mail>' + mail = LeapMail('', 'INBOX', + {'From': '=?iso-8859-1?q?=22=C4lbert_=DCbr=F6=22_=3C=E4=FC=F6=40example=2Email=3E?=', + 'To': '=?iso-8859-1?q?=22=C4lbert_=DCbr=F6=22_=3C=E4=FC=F6=40example=2Email=3E?=', + 'Cc': '=?iso-8859-1?q?=22=C4lbert_=DCbr=F6=22_=3C=E4=FC=F6=40example=2Email=3E?=', + 'Subject': '=?iso-8859-1?q?H=E4ll=F6_W=F6rld?='}) + + self.assertEqual([expected_address], mail.as_dict()['replying']['all']['to-field']) + self.assertEqual([expected_address], mail.as_dict()['replying']['all']['cc-field']) + self.assertEqual(expected_address, mail.as_dict()['replying']['single']) + def test_raw_constructed_by_headers_and_body(self): body = 'some body content' mail = LeapMail('doc id', 'INBOX', {'From': 'test@example.test', 'Subject': 'A test Mail', 'To': 'receiver@example.test'}, ('foo', 'bar'), body=body) |