summaryrefslogtreecommitdiff
path: root/src/mailman
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman')
-rw-r--r--src/mailman/commands/tests/test_confirm.py31
1 files changed, 31 insertions, 0 deletions
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))