summaryrefslogtreecommitdiff
path: root/src/mailman/workflows/tests/test_subscriptions.py
diff options
context:
space:
mode:
authorJ08nY2017-07-25 23:08:35 +0200
committerJ08nY2017-08-07 18:18:00 +0200
commitb902d7858d8302d248add89a5983c521c3581c4c (patch)
treecc48b02ce92a90d050404428f152055e09118347 /src/mailman/workflows/tests/test_subscriptions.py
parent139a4b484415843d4f0dcf723ed7b56fc52b2547 (diff)
downloadmailman-b902d7858d8302d248add89a5983c521c3581c4c.tar.gz
mailman-b902d7858d8302d248add89a5983c521c3581c4c.tar.zst
mailman-b902d7858d8302d248add89a5983c521c3581c4c.zip
Diffstat (limited to 'src/mailman/workflows/tests/test_subscriptions.py')
-rw-r--r--src/mailman/workflows/tests/test_subscriptions.py14
1 files changed, 13 insertions, 1 deletions
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.