diff options
Diffstat (limited to 'src/mailman/app/tests/test_moderation.py')
| -rw-r--r-- | src/mailman/app/tests/test_moderation.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mailman/app/tests/test_moderation.py b/src/mailman/app/tests/test_moderation.py index 45f94f27b..bb3958cd7 100644 --- a/src/mailman/app/tests/test_moderation.py +++ b/src/mailman/app/tests/test_moderation.py @@ -159,22 +159,29 @@ class TestUnsubscription(unittest.TestCase): def test_unsubscribe_defer(self): # When unsubscriptions must be approved by the moderator, but the # moderator defers this decision. - anne = getUtility(IUserManager).create_address( - 'anne@example.org', 'Anne Person') + user_manager = getUtility(IUserManager) + anne = user_manager.create_address('anne@example.org', 'Anne Person') token, token_owner, member = self._manager.register( anne, pre_verified=True, pre_confirmed=True, pre_approved=True) self.assertIsNone(token) self.assertEqual(member.address.email, 'anne@example.org') - mod = self._user_manager.create_user('bart@example.com', 'Bart User') - address = set_preferred(mod) + bart = user_manager.create_user('bart@example.com', 'Bart User') + address = set_preferred(bart) self._mlist.subscribe(address, MemberRole.moderator) # Now hold and handle an unsubscription request. token = hold_unsubscription(self._mlist, 'anne@example.org') handle_unsubscription(self._mlist, token, Action.defer) items = get_queue_messages('virgin', expected_count=2) - moderator_message = items[1] + # Find the moderator message. + for item in items: + if item.msg['to'] == 'test-owner@example.com': + break + else: + raise AssertionError('No moderator email found') + self.assertEqual(item.msgdata['recipients'], {'bart@example.com'}) self.assertEqual( - moderator_message.msgdata['recipients'], {'bart@example.com'}) + item.msg['subject'], + 'New unsubscription request from Test by anne@example.org') def test_bogus_token(self): # Try to handle an unsubscription with a bogus token. |
