Patchwork [1/2] tests/mboxviews: add test for correct From header

login
register
mail settings
Submitter Andreas Bießmann
Date May 10, 2013, 10:44 a.m.
Message ID <1368182666-28892-1-git-send-email-andreas.devel@googlemail.com>
Download mbox | patch
Permalink /patch/242958/
State Accepted
Commit b75cf75bf2b9aa0012f97e48936843f9bc6f1a9d
Headers show

Comments

Andreas Bießmann - May 10, 2013, 10:44 a.m.
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>
---
 apps/patchwork/tests/mboxviews.py |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
Jeremy Kerr - May 14, 2013, 10:39 a.m.
Hi Andreas,

> Currently we produce corrupted 'From' header in mbox output when
> senders name contains non ASCII characters. Provide a test to show
> this issue.

Thanks! I've applied and pushed both of these change.

Cheers,


Jeremy
Andreas Bießmann - May 21, 2013, 7:18 a.m.
Hi Jeremy,

On 05/14/2013 12:39 PM, Jeremy Kerr wrote:
> Hi Andreas,
> 
>> Currently we produce corrupted 'From' header in mbox output when
>> senders name contains non ASCII characters. Provide a test to show
>> this issue.
> 
> Thanks! I've applied and pushed both of these change.

can you please update the instance at http://patchwork.ozlabs.org?
For example http://patchwork.ozlabs.org/patch/197443/mbox/ has still

---8<---
From:
=?utf-8?q?Andreas_Bie=C3=9Fmann_=3Candreas=2Edevel=40googlemail=2Ecom?=
 =?utf-8?q?=3E?=
--->8---

Best regards

Andreas Bießmann
Jeremy Kerr - May 21, 2013, 7:22 a.m.
Hi Andreas,

> can you please update the instance at http://patchwork.ozlabs.org?

Sorry, missed a sync there. Should be working now.

Cheers,


Jeremy

Patch

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)