summaryrefslogtreecommitdiff
path: root/src/mailman/rules/tests/test_suspicious.py
diff options
context:
space:
mode:
authorMark Sapiro2017-07-26 08:11:33 -0700
committerMark Sapiro2017-07-26 08:11:33 -0700
commitbea94cb9538a55b1376afd42c2ce751efce62cfe (patch)
tree5fba570b0c6f4c0919009cb6f455c18bc732192a /src/mailman/rules/tests/test_suspicious.py
parent02826321d0430d7ffc1f674eeff4221941689ef7 (diff)
downloadmailman-bea94cb9538a55b1376afd42c2ce751efce62cfe.tar.gz
mailman-bea94cb9538a55b1376afd42c2ce751efce62cfe.tar.zst
mailman-bea94cb9538a55b1376afd42c2ce751efce62cfe.zip
Diffstat (limited to 'src/mailman/rules/tests/test_suspicious.py')
-rw-r--r--src/mailman/rules/tests/test_suspicious.py13
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')]
+ )