diff options
| author | Barry Warsaw | 2012-10-16 18:40:12 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2012-10-16 18:40:12 -0400 |
| commit | a1666479d87e26e5c79dd1cf507b8ef0472c59aa (patch) | |
| tree | 74672ad17daf516e53c2af66afbc5cfcf06fd5ed /src/mailman/app/tests/test_membership.py | |
| parent | d337335caa3e7116f73c2b18874c9a64d5f70957 (diff) | |
| download | mailman-a1666479d87e26e5c79dd1cf507b8ef0472c59aa.tar.gz mailman-a1666479d87e26e5c79dd1cf507b8ef0472c59aa.tar.zst mailman-a1666479d87e26e5c79dd1cf507b8ef0472c59aa.zip | |
Diffstat (limited to 'src/mailman/app/tests/test_membership.py')
| -rw-r--r-- | src/mailman/app/tests/test_membership.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/mailman/app/tests/test_membership.py b/src/mailman/app/tests/test_membership.py index 00c279910..113ae6a52 100644 --- a/src/mailman/app/tests/test_membership.py +++ b/src/mailman/app/tests/test_membership.py @@ -69,7 +69,7 @@ class AddMemberTest(unittest.TestCase): def test_add_member_banned(self): # Test that members who are banned by specific address cannot # subscribe to the mailing list. - getUtility(IBanManager).ban('anne@example.com', 'test@example.com') + IBanManager(self._mlist).ban('anne@example.com') self.assertRaises( MembershipIsBannedError, add_member, self._mlist, 'anne@example.com', 'Anne Person', @@ -78,43 +78,43 @@ class AddMemberTest(unittest.TestCase): def test_add_member_globally_banned(self): # Test that members who are banned by specific address cannot # subscribe to the mailing list. - getUtility(IBanManager).ban('anne@example.com') + IBanManager(None).ban('anne@example.com') self.assertRaises( MembershipIsBannedError, add_member, self._mlist, 'anne@example.com', 'Anne Person', '123', DeliveryMode.regular, system_preferences.preferred_language) def test_add_member_banned_from_different_list(self): - # Test that members who are banned by specific address cannot - # subscribe to the mailing list. - getUtility(IBanManager).ban('anne@example.com', 'sample@example.com') + # Test that members who are banned by on a different list can still be + # subscribed to other mlists. + sample_list = create_list('sample@example.com') + IBanManager(sample_list).ban('anne@example.com') member = add_member(self._mlist, 'anne@example.com', 'Anne Person', '123', DeliveryMode.regular, system_preferences.preferred_language) self.assertEqual(member.address.email, 'anne@example.com') def test_add_member_banned_by_pattern(self): - # Test that members who are banned by specific address cannot - # subscribe to the mailing list. - getUtility(IBanManager).ban('^.*@example.com', 'test@example.com') + # Addresses matching regexp ban patterns cannot subscribe. + IBanManager(self._mlist).ban('^.*@example.com') self.assertRaises( MembershipIsBannedError, add_member, self._mlist, 'anne@example.com', 'Anne Person', '123', DeliveryMode.regular, system_preferences.preferred_language) def test_add_member_globally_banned_by_pattern(self): - # Test that members who are banned by specific address cannot - # subscribe to the mailing list. - getUtility(IBanManager).ban('^.*@example.com') + # Addresses matching global regexp ban patterns cannot subscribe. + IBanManager(None).ban('^.*@example.com') self.assertRaises( MembershipIsBannedError, add_member, self._mlist, 'anne@example.com', 'Anne Person', '123', DeliveryMode.regular, system_preferences.preferred_language) def test_add_member_banned_from_different_list_by_pattern(self): - # Test that members who are banned by specific address cannot - # subscribe to the mailing list. - getUtility(IBanManager).ban('^.*@example.com', 'sample@example.com') + # Addresses matching regexp ban patterns on one list can still + # subscribe to other mailing lists. + sample_list = create_list('sample@example.com') + IBanManager(sample_list).ban('^.*@example.com') member = add_member(self._mlist, 'anne@example.com', 'Anne Person', '123', DeliveryMode.regular, system_preferences.preferred_language) |
