summaryrefslogtreecommitdiff
path: root/src/mailman/rules/tests/test_moderation.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/rules/tests/test_moderation.py')
-rw-r--r--src/mailman/rules/tests/test_moderation.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/mailman/rules/tests/test_moderation.py b/src/mailman/rules/tests/test_moderation.py
index 737b1f81d..79aade587 100644
--- a/src/mailman/rules/tests/test_moderation.py
+++ b/src/mailman/rules/tests/test_moderation.py
@@ -112,24 +112,26 @@ A message body.
reasons, ['The message comes from a moderated member'])
def test_these_nonmembers(self):
+ # Test the legacy *_these_nonmembers attributes.
user_manager = getUtility(IUserManager)
actions = {
- 'anne@example.com': "accept",
- 'bill@example.com': "hold",
- 'chris@example.com': "reject",
- 'dana@example.com': "discard",
- '^anne-.*@example.com': "accept",
- '^bill-.*@example.com': "hold",
- '^chris-.*@example.com': "reject",
- '^dana-.*@example.com': "discard",
- }
+ 'anne@example.com': 'accept',
+ 'bill@example.com': 'hold',
+ 'chris@example.com': 'reject',
+ 'dana@example.com': 'discard',
+ '^anne-.*@example.com': 'accept',
+ '^bill-.*@example.com': 'hold',
+ '^chris-.*@example.com': 'reject',
+ '^dana-.*@example.com': 'discard',
+ }
rule = moderation.NonmemberModeration()
user_manager = getUtility(IUserManager)
for address, action_name in actions.items():
- setattr(self._mlist, '{}_these_nonmembers'.format(action_name),
+ setattr(self._mlist,
+ '{}_these_nonmembers'.format(action_name),
[address])
if address.startswith('^'):
- # It's a pattern, craft a proper address
+ # It's a pattern, craft a proper address.
address = address[1:].replace('.*', 'something')
user_manager.create_address(address)
msg = mfs("""\
@@ -146,4 +148,4 @@ A message body.
self.assertTrue(result, 'NonmemberModeration rule should hit')
self.assertIn('moderation_action', msgdata)
self.assertEqual(msgdata['moderation_action'], action_name,
- "Wrong action for {}: {}".format(address, action_name))
+ 'Wrong action for {}: {}'.format(address, action_name))