summaryrefslogtreecommitdiff
path: root/src/mailman/handlers/tests
diff options
context:
space:
mode:
authorBarry Warsaw2014-11-29 15:10:59 -0500
committerBarry Warsaw2014-11-29 15:10:59 -0500
commite3357a5c0b4a708d793052efcc5c7d2a5dd3c1ba (patch)
treeaadf3f80f4559b82995eee9e851627fc0a70ab7f /src/mailman/handlers/tests
parent59110812266f4b1b3c73a6fb29fbb99da2dc31c3 (diff)
parent43b8f3f8faeccec1726466455f0affa9e98880d5 (diff)
downloadmailman-e3357a5c0b4a708d793052efcc5c7d2a5dd3c1ba.tar.gz
mailman-e3357a5c0b4a708d793052efcc5c7d2a5dd3c1ba.tar.zst
mailman-e3357a5c0b4a708d793052efcc5c7d2a5dd3c1ba.zip
* Fixed Unicode errors in the digest runner and when sending messages to the
site owner as a fallback. Given by Aurélien Bompard. (LP: #1130957). Also: * Convert some uses of the unicode() built-in to bytes.decode() in preparation for Python 3 and to eliminate some pyflakes errors. * Added LogFileMark.read() as a convenience method.
Diffstat (limited to 'src/mailman/handlers/tests')
-rw-r--r--src/mailman/handlers/tests/test_recipients.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mailman/handlers/tests/test_recipients.py b/src/mailman/handlers/tests/test_recipients.py
index 04789c281..afe533a7e 100644
--- a/src/mailman/handlers/tests/test_recipients.py
+++ b/src/mailman/handlers/tests/test_recipients.py
@@ -198,3 +198,24 @@ To: test-owner@example.com
msgdata = {}
self._process(self._mlist, self._msg, msgdata)
self.assertEqual(msgdata['recipients'], set(('noreply@example.com',)))
+
+ def test_site_admin_unicode(self):
+ # Since the config file is read as bytes, the site_owner is also a
+ # bytes and must be converted to unicode when used as a fallback.
+ self._cris.unsubscribe()
+ self._dave.unsubscribe()
+ self.assertEqual(self._mlist.administrators.member_count, 0)
+ msgdata = {}
+ # In order to properly mimic the testing environment, use
+ # config.push()/config.pop() directly instead of using the
+ # configuration() context manager.
+ config.push('test_site_admin_unicode', b"""\
+[mailman]
+site_owner: siteadmin@example.com
+""")
+ try:
+ self._process(self._mlist, self._msg, msgdata)
+ finally:
+ config.pop('test_site_admin_unicode')
+ self.assertEqual(len(msgdata['recipients']), 1)
+ self.assertIsInstance(list(msgdata['recipients'])[0], unicode)