summaryrefslogtreecommitdiff
path: root/tests/db
diff options
context:
space:
mode:
authorLucas Hoffmann <lucc@posteo.de>2018-10-11 01:22:42 +0200
committerPatrick Totzke <patricktotzke@gmail.com>2018-12-03 08:28:32 +0000
commit1d95cf991130df7f4d277ed2f840a397d512146d (patch)
treefca1b5efc4ff53340777d4a3a7d699f3a283ed87 /tests/db
parentd5b3aab3ac12e0f627b03aedbbe14c8df0d709b2 (diff)
Add test for #1301
This adds a test for detecting a malformed content-transfer-encoding (trailing semi-colon). It also changes the raised exception to the more appropriate ValueError.
Diffstat (limited to 'tests/db')
-rw-r--r--tests/db/utils_test.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/db/utils_test.py b/tests/db/utils_test.py
index 9fd49d76..fe4a1705 100644
--- a/tests/db/utils_test.py
+++ b/tests/db/utils_test.py
@@ -741,3 +741,10 @@ class TestRemoveCte(unittest.TestCase):
# This should not raise an UnicodeDecodeError.
utils.remove_cte(mail, as_string=True)
self.assertTrue(True)
+
+ def test_malformed_cte_value(self):
+ with open('tests/static/mail/malformed-header-CTE.eml') as fp:
+ mail = email.message_from_file(fp)
+ with self.assertRaisesRegex(ValueError,
+ "Unknown Content-Transfer-Encoding"):
+ utils.remove_cte(mail, as_string=True)