From 29054076f039fb5525c04ef74ca53a89c429cc33 Mon Sep 17 00:00:00 2001 From: J08nY Date: Fri, 14 Jul 2017 23:32:43 +0200 Subject: Add test which highlight the mismatch. --- src/mailman/commands/tests/test_confirm.py | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/mailman/commands/tests/test_confirm.py b/src/mailman/commands/tests/test_confirm.py index 1ef392b76..80ce01ceb 100644 --- a/src/mailman/commands/tests/test_confirm.py +++ b/src/mailman/commands/tests/test_confirm.py @@ -32,6 +32,7 @@ from mailman.testing.helpers import ( get_queue_messages, make_testable_runner, specialized_message_from_string as mfs, subscribe) from mailman.testing.layers import ConfigLayer +from mailman.utilities.datetime import now from zope.component import getUtility @@ -173,3 +174,33 @@ Confirmed - Done. """.format(token)) + + +class TestConfirmMismatch(unittest.TestCase): + layer = ConfigLayer + + def setUp(self): + self.one_mlist = create_list('one@example.com') + self.other_mlist = create_list('other@example.com') + + self.address = getUtility(IUserManager).create_address( + 'anne@example.com', 'display name') + self.address.verified_on = now() + + def test_confirm_mismatch(self): + self.one_mlist.subscription_policy = SubscriptionPolicy.confirm + self.other_mlist.subscription_policy = SubscriptionPolicy.confirm + + token, token_owner, member = ISubscriptionManager( + self.one_mlist).register(self.address) + + confirm = Message() + confirm['From'] = self.address.email + confirm['To'] = self.other_mlist.confirm_address(token) + confirm['Subject'] = 'Re: confirm {}'.format(token) + confirm.set_payload('') + + config.switchboards['command'].enqueue(confirm, + listid='other.example.com') + make_testable_runner(CommandRunner, 'command').run() + self.assertFalse(self.other_mlist.is_subscribed(self.address)) -- cgit v1.2.3-70-g09d2