summaryrefslogtreecommitdiff
path: root/src/mailman/commands/tests/test_confirm.py
diff options
context:
space:
mode:
authorBarry Warsaw2017-01-16 00:24:41 -0500
committerBarry Warsaw2017-01-16 00:24:41 -0500
commitabab1cb4afd1a0c41110c2e4bcd11cf74ef05775 (patch)
tree2a6fb08ca004331468fac9289e2ca5fe558ef417 /src/mailman/commands/tests/test_confirm.py
parenta5149b7167fb8c70beaa44a7dca287323a752131 (diff)
downloadmailman-abab1cb4afd1a0c41110c2e4bcd11cf74ef05775.tar.gz
mailman-abab1cb4afd1a0c41110c2e4bcd11cf74ef05775.tar.zst
mailman-abab1cb4afd1a0c41110c2e4bcd11cf74ef05775.zip
Diffstat (limited to 'src/mailman/commands/tests/test_confirm.py')
-rw-r--r--src/mailman/commands/tests/test_confirm.py32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/mailman/commands/tests/test_confirm.py b/src/mailman/commands/tests/test_confirm.py
index 650d37e29..1ef392b76 100644
--- a/src/mailman/commands/tests/test_confirm.py
+++ b/src/mailman/commands/tests/test_confirm.py
@@ -28,13 +28,15 @@ from mailman.interfaces.mailinglist import SubscriptionPolicy
from mailman.interfaces.subscriptions import ISubscriptionManager
from mailman.interfaces.usermanager import IUserManager
from mailman.runners.command import CommandRunner, Results
-from mailman.testing.helpers import get_queue_messages, make_testable_runner
+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 zope.component import getUtility
-class TestConfirm(unittest.TestCase):
- """Test the `confirm` command."""
+class TestConfirmJoin(unittest.TestCase):
+ """Test the `confirm` command when joining a mailing list."""
layer = ConfigLayer
@@ -72,6 +74,30 @@ class TestConfirm(unittest.TestCase):
get_queue_messages('virgin', expected_count=0)
+class TestConfirmLeave(unittest.TestCase):
+ """Test the `confirm` command when leaving a mailing list."""
+
+ layer = ConfigLayer
+
+ def setUp(self):
+ self._mlist = create_list('test@example.com')
+ anne = subscribe(self._mlist, 'Anne', email='anne@example.com')
+ self._token, token_owner, member = ISubscriptionManager(
+ self._mlist).unregister(anne.address)
+
+ def test_confirm_leave(self):
+ msg = mfs("""\
+From: Anne Person <anne@example.com>
+To: test-confirm+{token}@example.com
+Subject: Re: confirm {token}
+
+""".format(token=self._token))
+ Confirm().process(self._mlist, msg, {}, (self._token,), Results())
+ # Anne is no longer a member of the mailing list.
+ member = self._mlist.members.get_member('anne@example.com')
+ self.assertIsNone(member)
+
+
class TestEmailResponses(unittest.TestCase):
"""Test the `confirm` command through the command runner."""