aboutsummaryrefslogtreecommitdiff
path: root/src/mailman_pgp/mta
diff options
context:
space:
mode:
authorJ08nY2017-07-19 00:37:48 +0200
committerJ08nY2017-07-19 00:37:48 +0200
commitf40320e2b7590a886a92691b0f1e17f4be349489 (patch)
tree62c40b7858b9efc1a2b10250fc5c84df1cf2dfb1 /src/mailman_pgp/mta
parentfb9f42cd1ebdded7c3c579fd8046d37ee0a85849 (diff)
downloadmailman-pgp-f40320e2b7590a886a92691b0f1e17f4be349489.tar.gz
mailman-pgp-f40320e2b7590a886a92691b0f1e17f4be349489.tar.zst
mailman-pgp-f40320e2b7590a886a92691b0f1e17f4be349489.zip
Diffstat (limited to 'src/mailman_pgp/mta')
-rw-r--r--src/mailman_pgp/mta/personalized.py4
-rw-r--r--src/mailman_pgp/mta/tests/test_personalized.py33
2 files changed, 29 insertions, 8 deletions
diff --git a/src/mailman_pgp/mta/personalized.py b/src/mailman_pgp/mta/personalized.py
index 0d58328..d05cc4b 100644
--- a/src/mailman_pgp/mta/personalized.py
+++ b/src/mailman_pgp/mta/personalized.py
@@ -72,8 +72,8 @@ class PGPIndividualMixin:
@public
-class PGPPersonalizedDelivery(VERPMixin, DecoratingMixin, PersonalizedMixin,
- IndividualDelivery, PGPIndividualMixin):
+class PGPPersonalizedDelivery(IndividualDelivery, VERPMixin, DecoratingMixin,
+ PersonalizedMixin, PGPIndividualMixin):
""""""
def __init__(self):
diff --git a/src/mailman_pgp/mta/tests/test_personalized.py b/src/mailman_pgp/mta/tests/test_personalized.py
index 5550c4d..d9d0132 100644
--- a/src/mailman_pgp/mta/tests/test_personalized.py
+++ b/src/mailman_pgp/mta/tests/test_personalized.py
@@ -30,6 +30,7 @@ from mailman_pgp.mta.personalized import PGPPersonalizedDelivery
from mailman_pgp.pgp.tests.base import load_key
from mailman_pgp.pgp.wrapper import PGPWrapper
from mailman_pgp.testing.layers import PGPConfigLayer
+from mailman_pgp.utils.pgp import verifies
class PersonalizedDeliveryTester(PGPPersonalizedDelivery):
@@ -85,9 +86,14 @@ Subject: test
self.assertEqual(len(agent.deliveries), 1)
out_msg = agent.deliveries[0][1]
- wrapped = PGPWrapper(out_msg)
- self.assertTrue(wrapped.is_encrypted())
- decrypted = wrapped.decrypt(self.anne_key)
+ out_wrapped = PGPWrapper(out_msg)
+ self.assertTrue(out_wrapped.is_encrypted())
+
+ decrypted = out_wrapped.decrypt(self.list_key)
+ wrapped = PGPWrapper(decrypted)
+ self.assertTrue(wrapped.is_signed())
+
+ decrypted = out_wrapped.decrypt(self.anne_key)
wrapped = PGPWrapper(decrypted)
self.assertTrue(wrapped.is_signed())
@@ -104,9 +110,14 @@ Subject: test
self.assertEqual(len(agent.deliveries), 1)
out_msg = agent.deliveries[0][1]
- wrapped = PGPWrapper(out_msg)
- self.assertTrue(wrapped.is_encrypted())
- decrypted = wrapped.decrypt(self.anne_key)
+ out_wrapped = PGPWrapper(out_msg)
+ self.assertTrue(out_wrapped.is_encrypted())
+
+ decrypted = out_wrapped.decrypt(self.list_key)
+ wrapped = PGPWrapper(decrypted)
+ self.assertFalse(wrapped.is_signed())
+
+ decrypted = out_wrapped.decrypt(self.anne_key)
wrapped = PGPWrapper(decrypted)
self.assertFalse(wrapped.is_signed())
@@ -125,6 +136,7 @@ Subject: test
out_msg = agent.deliveries[0][1]
wrapped = PGPWrapper(out_msg)
self.assertTrue(wrapped.is_signed())
+ self.assertTrue(verifies(wrapped.verify(self.list_key.pubkey)))
def test_none(self):
with transaction():
@@ -142,3 +154,12 @@ Subject: test
wrapped = PGPWrapper(out_msg)
self.assertFalse(wrapped.is_signed())
self.assertFalse(wrapped.is_encrypted())
+
+ def test_no_pgp_list(self):
+ ordinary_list = create_list('ordinary@example.com')
+ msgdata = dict(recipients=['anne@example.org'])
+ agent = PersonalizedDeliveryTester()
+ refused = agent.deliver(ordinary_list, self.msg, msgdata)
+
+ self.assertEqual(len(refused), 0)
+ self.assertEqual(len(agent.deliveries), 1) \ No newline at end of file