summaryrefslogtreecommitdiff
path: root/service/test
diff options
context:
space:
mode:
authorLisa Junger <ljunger@thoughtworks.com>2015-03-31 17:10:11 +0200
committerLisa Junger <ljunger@thoughtworks.com>2015-04-02 17:54:21 +0200
commitdb5a88affdf696b833619d18cbcfdd408f206150 (patch)
treeed6649a17304ddabe26361a607cbfac7f16e15b4 /service/test
parentbd4fc909be410548283cb5d6f0d8a7eeaccc4405 (diff)
handle incorrectly encoded headers as ascii.
- Issue #347
Diffstat (limited to 'service/test')
-rw-r--r--service/test/unit/adapter/test_mail.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/service/test/unit/adapter/test_mail.py b/service/test/unit/adapter/test_mail.py
index c7910b7f..68b340a7 100644
--- a/service/test/unit/adapter/test_mail.py
+++ b/service/test/unit/adapter/test_mail.py
@@ -1,3 +1,4 @@
+# -*- coding: UTF-8 -*-
#
# Copyright (c) 2014 ThoughtWorks, Inc.
#
@@ -334,6 +335,17 @@ class TestPixelatedMail(unittest.TestCase):
mail.as_dict()
+ def test_parse_UTF8_headers_with_CharsetAscii(self):
+ leap_mail_from = u'"söme ümläuds" <lisa5@dev.pixelated-project.org>'
+ leap_mail_to = u'"söme ümläuds" <lisa5@dev.pixelated-project.org>,\n"söme ümläuds" <lisa5@dev.pixelated-project.org>'
+
+ leap_mail = test_helper.leap_mail(extra_headers={'From': leap_mail_from, 'Subject': "some subject", 'To': leap_mail_to})
+
+ mail = PixelatedMail.from_soledad(*leap_mail, soledad_querier=self.querier)
+
+ mail.headers['From'].encode('ascii')
+ self.assertEqual(mail.headers['To'], ['"sme mluds" <lisa5@dev.pixelated-project.org>', '"sme mluds" <lisa5@dev.pixelated-project.org>'])
+
def simple_mail_dict():
return {