From 0054cbaac43ebfe8e0bc713d6f00fef8a3743ab3 Mon Sep 17 00:00:00 2001 From: J08nY Date: Tue, 25 Jul 2017 23:08:35 +0200 Subject: Add more tests for coverage. --- src/mailman/workflows/tests/test_subscriptions.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/mailman/workflows/tests/test_subscriptions.py') diff --git a/src/mailman/workflows/tests/test_subscriptions.py b/src/mailman/workflows/tests/test_subscriptions.py index 23487ab1c..65569691b 100644 --- a/src/mailman/workflows/tests/test_subscriptions.py +++ b/src/mailman/workflows/tests/test_subscriptions.py @@ -24,7 +24,9 @@ from mailman.app.lifecycle import create_list from mailman.interfaces.bans import IBanManager from mailman.interfaces.member import MemberRole, MembershipIsBannedError from mailman.interfaces.pending import IPendings -from mailman.interfaces.subscriptions import TokenOwner +from mailman.interfaces.subscriptions import ( + SubscriptionPendingError, + TokenOwner) from mailman.interfaces.usermanager import IUserManager from mailman.testing.helpers import ( LogFileMark, get_queue_messages, set_preferred) @@ -157,6 +159,16 @@ class TestSubscriptionWorkflow(unittest.TestCase): workflow = ConfirmSubscriptionPolicy(self._mlist, anne) self.assertRaises(MembershipIsBannedError, list, workflow) + def test_sanity_checks_already_requested(self): + # An exception is raised if there is already a subscription request. + anne = self._user_manager.create_address(self._anne) + workflow = ConfirmSubscriptionPolicy(self._mlist, anne) + list(workflow) + other_workflow = ConfirmSubscriptionPolicy(self._mlist, anne) + self.assertRaises(SubscriptionPendingError, list, other_workflow) + # The original workflow token is still in the database. + self._expected_pendings_count = 1 + def test_verification_checks_with_verified_address(self): # When the address is already verified, we skip straight to the # confirmation checks. -- cgit v1.2.3-70-g09d2