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.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/mailman_pgp/rules/tests/test_signature.py b/src/mailman_pgp/rules/tests/test_signature.py
index a7eec5a..2f5881a 100644
--- a/src/mailman_pgp/rules/tests/test_signature.py
+++ b/src/mailman_pgp/rules/tests/test_signature.py
@@ -17,7 +17,6 @@
from unittest import TestCase
from mailman.app.lifecycle import create_list
-from mailman.config import config
from mailman.interfaces.action import Action
from mailman.interfaces.member import MemberRole
from mailman.interfaces.usermanager import IUserManager
@@ -25,6 +24,7 @@ from mailman.testing.helpers import (set_preferred,
specialized_message_from_string as mfs)
from zope.component import getUtility
+from mailman_pgp.config import mm_config
from mailman_pgp.database import mm_transaction, transaction
from mailman_pgp.model.address import PGPAddress
from mailman_pgp.model.list import PGPMailingList
@@ -33,7 +33,7 @@ from mailman_pgp.rules.signature import Signature
from mailman_pgp.testing.layers import PGPConfigLayer
-class TestSignature(TestCase):
+class TestSignatureRule(TestCase):
layer = PGPConfigLayer
def setUp(self):
@@ -41,7 +41,7 @@ class TestSignature(TestCase):
user_manager = getUtility(IUserManager)
with mm_transaction():
- self.mlist = create_list('nobody@example.com',
+ self.mlist = create_list('test@example.com',
style_name='pgp-default')
self.sender = user_manager.create_user('RSA-1024b@example.org')
set_preferred(self.sender)
@@ -64,14 +64,14 @@ class TestSignature(TestCase):
'data/mime_signed_invalid.eml')
def test_has_rule(self):
- self.assertIn(Signature.name, config.rules.keys())
+ self.assertIn(Signature.name, mm_config.rules.keys())
def test_no_pgp_list(self):
with mm_transaction():
- ordinary_list = create_list('test@example.com')
+ ordinary_list = create_list('odrinary@example.com')
msg = mfs("""\
From: anne@example.com
-To: test@example.com
+To: ordinary@example.com
""")
@@ -83,14 +83,19 @@ To: test@example.com
self.pgp_list.unsigned_msg_action = Action.defer
msg = mfs("""\
From: anne@example.com
-To: nobody@example.com
+To: test@example.com
""")
with self.assertRaises(ValueError):
self.rule.check(self.mlist, msg, {})
def test_no_key(self):
- pass
+ with transaction():
+ self.pgp_sender.key = None
+
+ msgdata = {}
+ with self.assertRaises(ValueError):
+ self.rule.check(self.mlist, self.msg_mime_signed, msgdata)
def assertAction(self, msgdata, action, reasons):
self.assertEqual(msgdata['moderation_action'], action.name)