summaryrefslogtreecommitdiff
path: root/src/mailman/app/tests/test_subscriptions.py
diff options
context:
space:
mode:
authorBarry Warsaw2015-04-13 13:16:22 -0400
committerBarry Warsaw2015-04-13 13:16:22 -0400
commit6f43b64a27f7e38df80a59f9111b5dedfac0d70f (patch)
treeda1d5948794a6c1dd65d661dc4dbd333631050f6 /src/mailman/app/tests/test_subscriptions.py
parent044a780a7a62fabc4f97975dac2725e8df8cdebe (diff)
downloadmailman-6f43b64a27f7e38df80a59f9111b5dedfac0d70f.tar.gz
mailman-6f43b64a27f7e38df80a59f9111b5dedfac0d70f.tar.zst
mailman-6f43b64a27f7e38df80a59f9111b5dedfac0d70f.zip
Diffstat (limited to 'src/mailman/app/tests/test_subscriptions.py')
-rw-r--r--src/mailman/app/tests/test_subscriptions.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/mailman/app/tests/test_subscriptions.py b/src/mailman/app/tests/test_subscriptions.py
index 45e17a9e5..31218d2d7 100644
--- a/src/mailman/app/tests/test_subscriptions.py
+++ b/src/mailman/app/tests/test_subscriptions.py
@@ -29,7 +29,9 @@ import unittest
from mailman.app.lifecycle import create_list
from mailman.app.subscriptions import SubscriptionWorkflow
from mailman.interfaces.address import InvalidEmailAddressError
-from mailman.interfaces.member import MemberRole, MissingPreferredAddressError
+from mailman.interfaces.bans import IBanManager
+from mailman.interfaces.member import (
+ MemberRole, MembershipIsBannedError, MissingPreferredAddressError)
from mailman.interfaces.requests import IListRequests, RequestType
from mailman.interfaces.subscriptions import (
MissingUserError, ISubscriptionService)
@@ -153,6 +155,20 @@ class TestSubscriptionWorkflow(unittest.TestCase):
workflow = SubscriptionWorkflow(self._mlist, user)
self.assertRaises(AssertionError, workflow.run_thru, 'sanity_checks')
+ def test_sanity_checks_globally_banned_address(self):
+ # An exception is raised if the address is globally banned.
+ anne = self._user_manager.create_address(self._anne)
+ IBanManager(None).ban(self._anne)
+ workflow = SubscriptionWorkflow(self._mlist, anne)
+ self.assertRaises(MembershipIsBannedError, list, workflow)
+
+ def test_sanity_checks_banned_address(self):
+ # An exception is raised if the address is banned by the mailing list.
+ anne = self._user_manager.create_address(self._anne)
+ IBanManager(self._mlist).ban(self._anne)
+ workflow = SubscriptionWorkflow(self._mlist, anne)
+ self.assertRaises(MembershipIsBannedError, list, workflow)
+
def test_verification_checks_with_verified_address(self):
# When the address is already verified, we skip straight to the
# confirmation checks.