diff options
Diffstat (limited to 'src/mailman/rules/tests/test_suspicious.py')
| -rw-r--r-- | src/mailman/rules/tests/test_suspicious.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mailman/rules/tests/test_suspicious.py b/src/mailman/rules/tests/test_suspicious.py index b40292283..4012c89d5 100644 --- a/src/mailman/rules/tests/test_suspicious.py +++ b/src/mailman/rules/tests/test_suspicious.py @@ -42,3 +42,16 @@ class TestSuspicious(unittest.TestCase): self._mlist.bounce_matching_headers = 'from: spam@example.com' result = self._rule.check(self._mlist, msg, {}) self.assertFalse(result) + + def test_suspicious_returns_reason(self): + msg = Message() + msg['From'] = Header('spam@example.com') + self._mlist.bounce_matching_headers = 'from: spam@example.com' + msgdata = {} + result = self._rule.check(self._mlist, msg, msgdata) + self.assertTrue(result) + self.assertEqual( + msgdata['moderation_reasons'], + [('Header "{}" matched a bounce_matching_header line', + 'spam@example.com')] + ) |
