diff options
| author | Barry Warsaw | 2017-01-16 14:56:27 +0000 |
|---|---|---|
| committer | Barry Warsaw | 2017-01-16 14:56:27 +0000 |
| commit | 1893d9abbaf99c27065f79ea10bd6d2914972cac (patch) | |
| tree | 2a6fb08ca004331468fac9289e2ca5fe558ef417 /src/mailman/commands/tests/test_confirm.py | |
| parent | a5149b7167fb8c70beaa44a7dca287323a752131 (diff) | |
| parent | abab1cb4afd1a0c41110c2e4bcd11cf74ef05775 (diff) | |
| download | mailman-1893d9abbaf99c27065f79ea10bd6d2914972cac.tar.gz mailman-1893d9abbaf99c27065f79ea10bd6d2914972cac.tar.zst mailman-1893d9abbaf99c27065f79ea10bd6d2914972cac.zip | |
Diffstat (limited to 'src/mailman/commands/tests/test_confirm.py')
| -rw-r--r-- | src/mailman/commands/tests/test_confirm.py | 32 |
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.""" |
