diff options
| author | J08nY | 2017-08-02 00:15:21 +0200 |
|---|---|---|
| committer | J08nY | 2017-08-02 01:35:10 +0200 |
| commit | fa2b97fb2e6e75af8bfc0bc3620b1a37179bdedc (patch) | |
| tree | 5dee4554ab4b99fb2dd9b93f8e43a4978ad0d469 /src/mailman_pgp/testing/pgp.py | |
| parent | dff7befbc5860f2f78f63ab694ef88d21a53771f (diff) | |
| download | mailman-pgp-fa2b97fb2e6e75af8bfc0bc3620b1a37179bdedc.tar.gz mailman-pgp-fa2b97fb2e6e75af8bfc0bc3620b1a37179bdedc.tar.zst mailman-pgp-fa2b97fb2e6e75af8bfc0bc3620b1a37179bdedc.zip | |
Diffstat (limited to 'src/mailman_pgp/testing/pgp.py')
| -rw-r--r-- | src/mailman_pgp/testing/pgp.py | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/mailman_pgp/testing/pgp.py b/src/mailman_pgp/testing/pgp.py index 7f207e3..90deb7a 100644 --- a/src/mailman_pgp/testing/pgp.py +++ b/src/mailman_pgp/testing/pgp.py @@ -142,20 +142,21 @@ class WrapperTestCase(TestCase): loaded = list(wrapped.keys()) self.assertEqual(len(loaded), len(keys)) - loaded_fingerprints = list(map(lambda key: key.fingerprint, loaded)) - fingerprints = list(map(lambda key: key.fingerprint, keys)) + get_fingerprint = lambda key: key.fingerprint + loaded_fingerprints = list(map(get_fingerprint, loaded)) + fingerprints = list(map(get_fingerprint, keys)) self.assertListEqual(loaded_fingerprints, fingerprints) def attach_keys(self, message, keys): wrapped = self.wrap(message) - for key in keys: - attached = wrapped.attach_key(key) - wrapped = self.wrap(attached) + attached = wrapped.attach_keys(*keys) + wrapped = self.wrap(attached) loaded = list(wrapped.keys()) self.assertTrue(wrapped.has_keys()) - loaded_fingerprints = list(map(lambda key: key.fingerprint, loaded)) - fingerprints = list(map(lambda key: key.fingerprint, keys)) + get_fingerprint = lambda key: key.fingerprint + loaded_fingerprints = list(map(get_fingerprint, loaded)) + fingerprints = list(map(get_fingerprint, keys)) self.assertListEqual(loaded_fingerprints, fingerprints) def has_revocs(self, message, has_revocs): @@ -176,6 +177,18 @@ class WrapperTestCase(TestCase): issuers = list(map(get_issuer, revocs)) self.assertListEqual(loaded_issuers, issuers) + def attach_revocs(self, message, revocs): + wrapped = self.wrap(message) + attached = wrapped.attach_revocs(*revocs) + wrapped = self.wrap(attached) + loaded = list(wrapped.revocs()) + + self.assertTrue(wrapped.has_revocs()) + get_issuer = lambda revoc: revoc.signer + loaded_issuers = list(map(get_issuer, loaded)) + issuers = list(map(get_issuer, revocs)) + self.assertListEqual(loaded_issuers, issuers) + def sign_encrypt_decrypt_verify(self, message, sign_key, encrypt_key): wrapped = self.wrap(message) encrypted = wrapped.sign_encrypt(sign_key, encrypt_key.pubkey) |
