aboutsummaryrefslogtreecommitdiff
path: root/src/mailman_pgp/rules/tests/test_signature.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman_pgp/rules/tests/test_signature.py')
-rw-r--r--src/mailman_pgp/rules/tests/test_signature.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mailman_pgp/rules/tests/test_signature.py b/src/mailman_pgp/rules/tests/test_signature.py
index 56baf08..f5c5dc3 100644
--- a/src/mailman_pgp/rules/tests/test_signature.py
+++ b/src/mailman_pgp/rules/tests/test_signature.py
@@ -75,8 +75,8 @@ To: ordinary@example.com
""")
- with self.assertRaises(ValueError):
- self.rule.check(ordinary_list, msg, {})
+ matches = self.rule.check(ordinary_list, msg, {})
+ self.assertFalse(matches)
def test_no_address(self):
with transaction():
@@ -86,16 +86,19 @@ From: anne@example.com
To: test@example.com
""")
- with self.assertRaises(ValueError):
- self.rule.check(self.mlist, msg, {})
+ matches = self.rule.check(self.mlist, msg, {})
+ self.assertFalse(matches)
def test_no_key(self):
with transaction():
self.pgp_sender.key = None
msgdata = {}
- with self.assertRaises(ValueError):
- self.rule.check(self.mlist, self.msg_mime_signed, msgdata)
+ matches = self.rule.check(self.mlist, self.msg_mime_signed, msgdata)
+ self.assertTrue(matches)
+ self.assertAction(msgdata, Action.reject, [
+ 'No key set for address {}.'.format(
+ self.pgp_sender.address.original_email)])
def assertAction(self, msgdata, action, reasons):
self.assertEqual(msgdata['moderation_action'], action.name)