diff options
| author | Aurélien Bompard | 2015-03-27 16:50:01 +0100 |
|---|---|---|
| committer | Aurélien Bompard | 2015-03-27 16:50:01 +0100 |
| commit | b62a026ad136147d9f1e1e9604f98bd4d98a3389 (patch) | |
| tree | 26900fef6c944616ef88558c1ef8013db0ea3ffe /src | |
| parent | 9fe551853e8170040a1f09fa340b1a6a4ff4194c (diff) | |
| download | mailman-b62a026ad136147d9f1e1e9604f98bd4d98a3389.tar.gz mailman-b62a026ad136147d9f1e1e9604f98bd4d98a3389.tar.zst mailman-b62a026ad136147d9f1e1e9604f98bd4d98a3389.zip | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/app/subscriptions.py | 2 | ||||
| -rw-r--r-- | src/mailman/app/tests/test_subscriptions.py | 21 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/mailman/app/subscriptions.py b/src/mailman/app/subscriptions.py index 0fc10572a..1e45da43e 100644 --- a/src/mailman/app/subscriptions.py +++ b/src/mailman/app/subscriptions.py @@ -202,7 +202,7 @@ class SubscriptionWorkflow(Workflow): def _step_moderation_check(self): # Does the moderator need to approve the subscription request? - if self.mlist.subscription_policy in ( + if not self.pre_approved and self.mlist.subscription_policy in ( SubscriptionPolicy.moderate, SubscriptionPolicy.confirm_then_moderate): self._next.append("get_moderator_approval") diff --git a/src/mailman/app/tests/test_subscriptions.py b/src/mailman/app/tests/test_subscriptions.py index 325126214..b19dc5398 100644 --- a/src/mailman/app/tests/test_subscriptions.py +++ b/src/mailman/app/tests/test_subscriptions.py @@ -166,5 +166,24 @@ class TestSubscriptionWorkflow(unittest.TestCase): request_db.delete_request(requests[0].id) self._mlist.subscription_policy = SubscriptionPolicy.moderate _do_check() - self._mlist.subscription_policy = SubscriptionPolicy.confirm_then_moderate + self._mlist.subscription_policy = \ + SubscriptionPolicy.confirm_then_moderate _do_check() + + def test_confirmation_required(self): + # Tests subscriptions where user confirmation is required + self._mlist.subscription_policy = \ + SubscriptionPolicy.confirm_then_moderate + anne = self._user_manager.create_address(self._anne, 'Anne Person') + self.assertIsNone(self._mlist.subscribers.get_member(self._anne)) + workflow = SubscriptionWorkflow( + self._mlist, anne, + pre_verified=True, pre_confirmed=False, pre_approved=True) + # Run the state machine to the end. + list(workflow) + # A confirmation request must be pending + # TODO: test it + # Now restore and re-run the state machine as if we got the confirmation + workflow.restore_state() + list(workflow) + self.assertIsNotNone(self._mlist.subscribers.get_member(self._anne)) |
