diff options
Diffstat (limited to 'src/mailman_pgp/runners')
| -rw-r--r-- | src/mailman_pgp/runners/incoming.py | 2 | ||||
| -rw-r--r-- | src/mailman_pgp/runners/tests/test_incoming.py | 28 |
2 files changed, 12 insertions, 18 deletions
diff --git a/src/mailman_pgp/runners/incoming.py b/src/mailman_pgp/runners/incoming.py index 9931576..abedd32 100644 --- a/src/mailman_pgp/runners/incoming.py +++ b/src/mailman_pgp/runners/incoming.py @@ -61,7 +61,7 @@ class PGPIncomingRunner(Runner): return True try: - msg = wrapped.decrypt(list_key) + msg = wrapped.decrypt(list_key).msg except PGPError: reason = 'Message could not be decrypted.' log.info('[pgp] {}{}: {}'.format( diff --git a/src/mailman_pgp/runners/tests/test_incoming.py b/src/mailman_pgp/runners/tests/test_incoming.py index 05e910a..aaf597c 100644 --- a/src/mailman_pgp/runners/tests/test_incoming.py +++ b/src/mailman_pgp/runners/tests/test_incoming.py @@ -87,11 +87,10 @@ To: no-key@example.com Some text. """) - wrapped = PGPWrapper(msg) - encrypted = wrapped.encrypt(self.pgp_list.pubkey) + PGPWrapper(msg).encrypt(self.pgp_list.pubkey) msgdata = dict(listid='no-key.example.com') - mm_config.switchboards['in'].enqueue(encrypted, msgdata) + mm_config.switchboards['in'].enqueue(msg, msgdata) runner = make_testable_runner(PGPIncomingRunner, 'in', lambda runner: True) runner.run() @@ -130,12 +129,10 @@ To: test@example.com {} """.format(str(payload))) - wrapped = PGPWrapper(msg) - encrypted = wrapped.encrypt(self.pgp_list.pubkey) + encrypted = PGPWrapper(msg).copy().encrypt(self.pgp_list.pubkey).msg msgdata = dict(listid='test.example.com') - mm_config.switchboards['in'].enqueue(encrypted, - msgdata) + mm_config.switchboards['in'].enqueue(encrypted, msgdata) self.runner.run() items = get_queue_messages('in_default', expected_count=1) out_msg = items[0].msg @@ -149,14 +146,13 @@ To: test@example.com {} """.format(str(payload))) - wrapped = PGPWrapper(msg) - encrypted_signed = wrapped.sign_encrypt(self.sender_key, - self.pgp_list.pubkey, - self.pgp_sender.key) + PGPWrapper(msg).sign_encrypt(self.sender_key, + self.pgp_list.pubkey, + self.pgp_sender.key) msgdata = dict(listid='test.example.com') - mm_config.switchboards['in'].enqueue(encrypted_signed, - msgdata) + mm_config.switchboards['in'].enqueue(msg, msgdata) + self.runner.run() items = get_queue_messages('in_default', expected_count=1) out_msg = items[0].msg @@ -173,12 +169,10 @@ To: test@example.com {} """.format(str(payload))) - wrapped = PGPWrapper(msg) - encrypted = wrapped.encrypt(self.sender_key.pubkey) + PGPWrapper(msg).encrypt(self.sender_key.pubkey) msgdata = dict(listid='test.example.com') - mm_config.switchboards['in'].enqueue(encrypted, - msgdata) + mm_config.switchboards['in'].enqueue(msg, msgdata) self.runner.run() items = get_queue_messages('in_default', expected_count=1) self.assertEqual(items[0].msgdata['pgp_action'], |
