summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorAndreas Bießmann <andreas.devel@googlemail.com>2013-05-10 00:44:25 +0000
committerJeremy Kerr <jk@ozlabs.org>2013-05-14 18:36:04 +0800
commitb75cf75bf2b9aa0012f97e48936843f9bc6f1a9d (patch)
tree95caabe63cfc2a2069d41ef040203a98cccfe04b /apps
parent99209535d901a7bb1f10ad7d1de0a9f6308b2ce7 (diff)
downloadpatchwork-b75cf75bf2b9aa0012f97e48936843f9bc6f1a9d.tar.bz2
patchwork-b75cf75bf2b9aa0012f97e48936843f9bc6f1a9d.tar.xz
tests/mboxviews: add test for correct From header
Currently we produce corrupted 'From' header in mbox output when senders name contains non ASCII characters. Provide a test to show this issue. Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'apps')
-rw-r--r--apps/patchwork/tests/mboxviews.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/patchwork/tests/mboxviews.py b/apps/patchwork/tests/mboxviews.py
index a3c10cf..07513c2 100644
--- a/apps/patchwork/tests/mboxviews.py
+++ b/apps/patchwork/tests/mboxviews.py
@@ -1,3 +1,5 @@
+# vim: set fileencoding=utf-8 :
+#
# Patchwork - automated patch tracking system
# Copyright (C) 2009 Jeremy Kerr <jk@ozlabs.org>
#
@@ -107,3 +109,26 @@ class MboxPassThroughHeaderTest(TestCase):
response = self.client.get('/patch/%d/mbox/' % self.patch.id)
self.assertContains(response, self.to_header)
+
+class MboxBrokenFromHeaderTest(TestCase):
+ """ Test that a person with characters outside ASCII in his name do
+ produce correct From header. As RFC 2822 state we must retain the
+ <user@doamin.tld> format for the mail while the name part may be coded
+ in some ways. """
+
+ def setUp(self):
+ defaults.project.save()
+ self.person = defaults.patch_author_person
+ self.person.name = u'©ool guŷ'
+ self.person.save()
+
+ self.patch = Patch(project = defaults.project,
+ msgid = 'p1', name = 'testpatch',
+ submitter = self.person, content = '')
+
+ def testFromHeader(self):
+ self.patch.save()
+ from_email = '<' + self.person.email + '>'
+
+ response = self.client.get('/patch/%d/mbox/' % self.patch.id)
+ self.assertContains(response, from_email)