summaryrefslogtreecommitdiff
path: root/src/mailman/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/handlers')
-rw-r--r--src/mailman/handlers/tests/test_recipients.py27
-rw-r--r--src/mailman/handlers/to_digest.py2
2 files changed, 10 insertions, 19 deletions
diff --git a/src/mailman/handlers/tests/test_recipients.py b/src/mailman/handlers/tests/test_recipients.py
index 8f2a9d47d..ef2021d2c 100644
--- a/src/mailman/handlers/tests/test_recipients.py
+++ b/src/mailman/handlers/tests/test_recipients.py
@@ -26,14 +26,14 @@ __all__ = [
]
-import six
import unittest
from mailman.app.lifecycle import create_list
from mailman.config import config
from mailman.interfaces.member import DeliveryMode, DeliveryStatus, MemberRole
from mailman.interfaces.usermanager import IUserManager
-from mailman.testing.helpers import specialized_message_from_string as mfs
+from mailman.testing.helpers import (
+ configuration, specialized_message_from_string as mfs)
from mailman.testing.layers import ConfigLayer
from zope.component import getUtility
@@ -200,23 +200,14 @@ To: test-owner@example.com
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.
+ @configuration('mailman', site_owner='siteadmin@example.com')
+ def test_no_owners_site_owner_fallback(self):
+ # The list has no owners or moderators, but there is a non-default
+ # site owner defined. That owner gets the message.
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], six.text_type)
+ self._process(self._mlist, self._msg, msgdata)
+ self.assertEqual(msgdata['recipients'],
+ set(('siteadmin@example.com',)))
diff --git a/src/mailman/handlers/to_digest.py b/src/mailman/handlers/to_digest.py
index e915bbfa3..9eb5818bb 100644
--- a/src/mailman/handlers/to_digest.py
+++ b/src/mailman/handlers/to_digest.py
@@ -55,7 +55,7 @@ class ToDigest:
mailbox_path = os.path.join(mlist.data_path, 'digest.mmdf')
# Lock the mailbox and append the message.
with Mailbox(mailbox_path, create=True) as mbox:
- mbox.add(msg.as_string())
+ mbox.add(msg)
# Calculate the current size of the mailbox file. This will not tell
# us exactly how big the resulting MIME and rfc1153 digest will
# actually be, but it's the most easily available metric to decide