summaryrefslogtreecommitdiff
path: root/src/mailman/rules/tests
diff options
context:
space:
mode:
authorAurélien Bompard2016-03-08 18:23:53 +0100
committerBarry Warsaw2016-03-10 17:43:11 -0500
commitaae1f92285ec2b26b7569802261648c24d80d957 (patch)
treebef40f17b3e87d3db099a2f7627f21d3013827f3 /src/mailman/rules/tests
parentcb8ddd1671e424478f002e527871f0c5839425d9 (diff)
downloadmailman-aae1f92285ec2b26b7569802261648c24d80d957.tar.gz
mailman-aae1f92285ec2b26b7569802261648c24d80d957.tar.zst
mailman-aae1f92285ec2b26b7569802261648c24d80d957.zip
Diffstat (limited to 'src/mailman/rules/tests')
-rw-r--r--src/mailman/rules/tests/test_approved.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/mailman/rules/tests/test_approved.py b/src/mailman/rules/tests/test_approved.py
index 73812f030..401e26634 100644
--- a/src/mailman/rules/tests/test_approved.py
+++ b/src/mailman/rules/tests/test_approved.py
@@ -400,8 +400,14 @@ class TestApprovedNonASCII(unittest.TestCase):
def setUp(self):
self._mlist = create_list('test@example.com')
+ self._mlist.moderator_password = config.password_context.encrypt(
+ 'super secret')
self._rule = approved.Approved()
- self._msg = mfs("""\
+
+ def test_nonascii_body_missing_header(self):
+ # When the message body contains non-ascii, the rule should not throw
+ # unicode errors. LP: #949924.
+ msg = mfs("""\
From: anne@example.com
To: test@example.com
Subject: A Message with non-ascii body
@@ -412,11 +418,24 @@ Content-Transfer-Encoding: quoted-printable
This is a message body with a non-ascii character =E4
""")
+ result = self._rule.check(self._mlist, msg, {})
+ self.assertFalse(result)
- def test_nonascii_body_missing_header(self):
- # When the message body contains non-ascii, the rule should not throw
- # unicode errors. LP: #949924.
- result = self._rule.check(self._mlist, self._msg, {})
+ def test_unknown_charset(self):
+ # When the charset is unknown, the rule should not crash. GL: #203
+ msg = mfs("""\
+From: anne@example.com
+To: test@example.com
+Subject: A Message with non-ascii body
+Message-ID: <ant>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=unknown-8bit
+Content-Disposition: inline
+Content-Transfer-Encoding: quoted-printable
+
+This is a message body with a non-ascii character =E4
+""")
+ result = self._rule.check(self._mlist, msg, {})
self.assertFalse(result)