31
from zope.component import getUtility
32
28
from mailman.app.lifecycle import create_list
33
29
from mailman.config import config
34
30
from mailman.interfaces.member import DeliveryMode, DeliveryStatus, MemberRole
35
31
from mailman.interfaces.usermanager import IUserManager
36
from mailman.testing.helpers import specialized_message_from_string as mfs
32
from mailman.testing.helpers import (
33
configuration, specialized_message_from_string as mfs)
37
34
from mailman.testing.layers import ConfigLayer
35
from zope.component import getUtility
199
197
self._process(self._mlist, self._msg, msgdata)
200
198
self.assertEqual(msgdata['recipients'], set(('noreply@example.com',)))
202
def test_site_admin_unicode(self):
203
# Since the config file is read as bytes, the site_owner is also a
204
# bytes and must be converted to unicode when used as a fallback.
200
@configuration('mailman', site_owner='siteadmin@example.com')
201
def test_no_owners_site_owner_fallback(self):
202
# The list has no owners or moderators, but there is a non-default
203
# site owner defined. That owner gets the message.
205
204
self._cris.unsubscribe()
206
205
self._dave.unsubscribe()
207
206
self.assertEqual(self._mlist.administrators.member_count, 0)
209
# In order to properly mimic the testing environment, use
210
# config.push()/config.pop() directly instead of using the
211
# configuration() context manager.
212
config.push('test_site_admin_unicode', b"""\
214
site_owner: siteadmin@example.com
217
self._process(self._mlist, self._msg, msgdata)
219
config.pop('test_site_admin_unicode')
220
self.assertEqual(len(msgdata['recipients']), 1)
221
self.assertIsInstance(list(msgdata['recipients'])[0], unicode)
208
self._process(self._mlist, self._msg, msgdata)
209
self.assertEqual(msgdata['recipients'],
210
set(('siteadmin@example.com',)))