diff options
| -rw-r--r-- | src/mailman_pgp/plugin.py | 3 | ||||
| -rw-r--r-- | src/mailman_pgp/runners/tests/test_incoming.py | 7 |
2 files changed, 3 insertions, 7 deletions
diff --git a/src/mailman_pgp/plugin.py b/src/mailman_pgp/plugin.py index 2a8207c..2b59236 100644 --- a/src/mailman_pgp/plugin.py +++ b/src/mailman_pgp/plugin.py @@ -52,8 +52,7 @@ class PGPMailman: @classhandler.handler(ListDeletedEvent) def on_delete(mlist): - pgp_list = PGPMailingList.query().filter_by( - list_id=mlist.list_id).first() + pgp_list = PGPMailingList.for_list(mlist) if pgp_list: with transaction() as session: # TODO shred the list key diff --git a/src/mailman_pgp/runners/tests/test_incoming.py b/src/mailman_pgp/runners/tests/test_incoming.py index f98aede..f879bc5 100644 --- a/src/mailman_pgp/runners/tests/test_incoming.py +++ b/src/mailman_pgp/runners/tests/test_incoming.py @@ -49,6 +49,8 @@ class TestIncoming(TestCase): self.mlist.subscribe(self.sender, MemberRole.member) self.pgp_list = PGPMailingList.for_list(self.mlist) + while self.pgp_list.pubkey is None: + sleep(1) sender_key = load_key('data/rsa_1024.pub.asc') with transaction() as t: @@ -102,11 +104,6 @@ To: ordinary@example.com get_queue_messages('in_default', expected_count=1) def test_decrypt(self): - for i in range(15): # pragma: no cover - if self.pgp_list.pubkey is not None: - break - sleep(1) - payload = 'Some encrypted text.' pmsg = PGPMessage.new(payload) emsg = self.pgp_list.pubkey.encrypt(pmsg) |
