]> git.ozlabs.org Git - patchwork/blobdiff - apps/patchwork/tests/test_patchparser.py
parsemail: Fallback to common charsets when charset is None or x-unknown
[patchwork] / apps / patchwork / tests / test_patchparser.py
index 0496a69f231e21f5e0dda86c8b247560c5a7a8ea..d9a24c1933b866d1397c5b5a8658c4f7b881980a 100644 (file)
@@ -422,6 +422,17 @@ class CVSFormatPatchTest(MBoxPatchTest):
         self.assertTrue(comment is not None)
         self.assertTrue(patch.content.startswith('Index'))
 
+class CharsetFallbackPatchTest(MBoxPatchTest):
+    """ Test mail with and invalid charset name, and check that we can parse
+        with one of the fallback encodings"""
+
+    mail_file = '0010-invalid-charset.mbox'
+
+    def testPatch(self):
+        (patch, comment) = find_content(self.project, self.mail)
+        self.assertTrue(patch is not None)
+        self.assertTrue(comment is not None)
+
 class DelegateRequestTest(TestCase):
     patch_filename = '0001-add-line.patch'
     msgid = '<1@example.com>'