summaryrefslogtreecommitdiff
path: root/src/mailman/workflows
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/workflows')
-rw-r--r--src/mailman/workflows/common.py2
-rw-r--r--src/mailman/workflows/tests/test_subscriptions.py14
2 files changed, 14 insertions, 2 deletions
diff --git a/src/mailman/workflows/common.py b/src/mailman/workflows/common.py
index 1f63d3d1d..c250785c2 100644
--- a/src/mailman/workflows/common.py
+++ b/src/mailman/workflows/common.py
@@ -211,7 +211,7 @@ class SubscriptionBase(SubscriptionWorkflowCommon):
# verified by a full coverage run, but diffcov for some reason
# claims that the test added in the branch that added this code
# does not cover the change. That seems like a bug in diffcov.
- raise AlreadySubscribedError( # pragma: no cover
+ raise AlreadySubscribedError( # pragma: nocover
self.mlist.fqdn_listname,
self.address.email,
MemberRole.member)
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.