diff options
| author | Barry Warsaw | 2015-11-06 20:54:31 -0600 |
|---|---|---|
| committer | Barry Warsaw | 2015-11-08 21:00:17 -0500 |
| commit | 879276c5594b002227615b46603d48120043703a (patch) | |
| tree | d76dd421252270c9d15c2b448afe6f97a94e5d5f /src/mailman/chains/tests/test_hold.py | |
| parent | bd8b1d5f0e7c9d89ab7e68cd361450dd18a24ae3 (diff) | |
| download | mailman-879276c5594b002227615b46603d48120043703a.tar.gz mailman-879276c5594b002227615b46603d48120043703a.tar.zst mailman-879276c5594b002227615b46603d48120043703a.zip | |
Diffstat (limited to 'src/mailman/chains/tests/test_hold.py')
| -rw-r--r-- | src/mailman/chains/tests/test_hold.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/mailman/chains/tests/test_hold.py b/src/mailman/chains/tests/test_hold.py index da87c8d15..3e0b4b9fa 100644 --- a/src/mailman/chains/tests/test_hold.py +++ b/src/mailman/chains/tests/test_hold.py @@ -25,6 +25,7 @@ __all__ = [ import unittest +from email import message_from_bytes as mfb from mailman.app.lifecycle import create_list from mailman.chains.hold import autorespond_to_sender from mailman.core.chains import process as process_chain @@ -34,6 +35,7 @@ from mailman.testing.helpers import ( LogFileMark, configuration, get_queue_messages, specialized_message_from_string as mfs) from mailman.testing.layers import ConfigLayer +from pkg_resources import resource_filename from zope.component import getUtility @@ -135,3 +137,31 @@ A message body. logged = logfile.read() self.assertIn('TEST-REASON-1', logged) self.assertIn('TEST-REASON-2', logged) + + def test_hold_chain_charset(self): + # Issue #144 - UnicodeEncodeError in the hold chain. + self._mlist.admin_immed_notify = True + self._mlist.respond_to_post_requests = False + path = resource_filename('mailman.chains.tests', 'issue144.eml') + with open(path, 'rb') as fp: + msg = mfb(fp.read()) + msg.sender = 'anne@example.com' + process_chain(self._mlist, msg, {}, start_chain='hold') + # The postauth.txt message is now in the virgin queue awaiting + # delivery to the moderators. + items = get_queue_messages('virgin') + self.assertEqual(len(items), 1) + msgdata = items[0].msgdata + self.assertTrue(msgdata['tomoderators']) + self.assertEqual(msgdata['recipients'], {'test-owner@example.com'}) + # Ensure that the subject looks correct in the postauth.txt. + msg = items[0].msg + value = None + for line in msg.get_payload(0).get_payload().splitlines(): + if line.strip().startswith('Subject:'): + header, colon, value = line.partition(':') + break + self.assertEqual(value.lstrip(), 'Vi?enamjenski pi?tolj za vodu 8/1') + self.assertEqual( + msg['Subject'], + 'test@example.com post from anne@example.com requires approval') |
