diff test/test_mailgw.py @ 5547:081be318661b

Do not transcode binary email attachments (issue2551004). Only transcode attachments if a charset is specified or if they have a text/* content-type.
author Joseph Myers <jsm@polyomino.org.uk>
date Wed, 26 Sep 2018 01:24:19 +0000
parents 52e50ab5dfda
children f8893e1cde0d
line wrap: on
line diff
--- a/test/test_mailgw.py	Tue Sep 25 17:06:18 2018 +0200
+++ b/test/test_mailgw.py	Wed Sep 26 01:24:19 2018 +0000
@@ -832,7 +832,6 @@
 --001485f339f8f361fb049188dbba--
 '''
 
-    @pytest.mark.xfail
     def testOctetStreamTranscoding(self):
         self.doNewIssue()
         self._handle_mail(self.octetstream_msg)
@@ -841,13 +840,13 @@
         msg = self.db.msg.getnode (messages[-1])
         assert(len(msg.files) == 1)
         names = {0 : 'testfile'}
-        content = ['''This is a file containing text
+        content = [b'''This is a file containing text
 in latin-1 format \xE4\xF6\xFC\xC4\xD6\xDC\xDF
 ''']
         for n, id in enumerate (msg.files):
             f = self.db.file.getnode (id)
             self.assertEqual(f.name, names.get (n, 'unnamed'))
-            self.assertEqual(f.content, content [n])
+            self.assertEqual(f.binary_content, content [n])
 
     def testMultipartKeepAlternatives(self):
         self.doNewIssue()

Roundup Issue Tracker: http://roundup-tracker.org/