summaryrefslogtreecommitdiff
path: root/src/mailman/rest/tests/test_moderation.py
diff options
context:
space:
mode:
authorBarry Warsaw2017-08-29 22:51:58 -0400
committerBarry Warsaw2017-08-29 22:51:58 -0400
commit057bc0704ab6d975e327c11cac204decfb478c4d (patch)
tree9c22f42b28dd6818188fe6ecf5aefb53c192d503 /src/mailman/rest/tests/test_moderation.py
parentde8c204fa40f0c4677a1b73b2ee7e3e86ce93a9c (diff)
downloadmailman-057bc0704ab6d975e327c11cac204decfb478c4d.tar.gz
mailman-057bc0704ab6d975e327c11cac204decfb478c4d.tar.zst
mailman-057bc0704ab6d975e327c11cac204decfb478c4d.zip
Diffstat (limited to 'src/mailman/rest/tests/test_moderation.py')
-rw-r--r--src/mailman/rest/tests/test_moderation.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mailman/rest/tests/test_moderation.py b/src/mailman/rest/tests/test_moderation.py
index 0a9bb2608..4f6894ebb 100644
--- a/src/mailman/rest/tests/test_moderation.py
+++ b/src/mailman/rest/tests/test_moderation.py
@@ -144,6 +144,25 @@ Something else.
dict(action='discard'))
self.assertEqual(cm.exception.code, 404)
+ def test_subject_encoding_error(self):
+ # GL#383: messages with badly encoded Subject headers crash the REST
+ # server.
+ self._msg = mfs("""\
+From: anne@example.com
+To: ant@example.com
+Subject: =?GB2312?B?saa9o7fmtNPEpbVaQ2h1o6zDt7uoz+PX1L/guq7AtKGj?=
+Message-ID: <alpha>
+
+Something else.
+""")
+ with transaction():
+ held_id = hold_message(self._mlist, self._msg)
+ json, response = call_api(
+ 'http://localhost:9001/3.0/lists/ant@example.com/held')
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(json['total_size'], 1)
+ self.assertEqual(json['entries'][0]['request_id'], held_id)
+
class TestSubscriptionModeration(unittest.TestCase):
layer = RESTLayer