diff options
| author | J08nY | 2017-07-07 18:04:14 +0200 |
|---|---|---|
| committer | J08nY | 2017-07-07 18:04:14 +0200 |
| commit | 0b18a7c76d82eef8ec3cf11dab29bf219aeb3035 (patch) | |
| tree | 085fa94c18f696505d3e7fc892c7ebfa732fd71e /src/mailman_pgp/pgp | |
| parent | 45174af3b9b410102022cb5c335e42c7e0052b19 (diff) | |
| download | mailman-pgp-0b18a7c76d82eef8ec3cf11dab29bf219aeb3035.tar.gz mailman-pgp-0b18a7c76d82eef8ec3cf11dab29bf219aeb3035.tar.zst mailman-pgp-0b18a7c76d82eef8ec3cf11dab29bf219aeb3035.zip | |
Move test data to subdirectories.
Diffstat (limited to 'src/mailman_pgp/pgp')
| -rw-r--r-- | src/mailman_pgp/pgp/tests/base.py | 16 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/keys/ecc_p256.priv.asc (renamed from src/mailman_pgp/pgp/tests/data/ecc_p256.priv.asc) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/keys/ecc_p256.pub.asc (renamed from src/mailman_pgp/pgp/tests/data/ecc_p256.pub.asc) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/keys/rsa_1024.priv.asc (renamed from src/mailman_pgp/pgp/tests/data/rsa_1024.priv.asc) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/keys/rsa_1024.pub.asc (renamed from src/mailman_pgp/pgp/tests/data/rsa_1024.pub.asc) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/messages/clear.eml (renamed from src/mailman_pgp/pgp/tests/data/clear.eml) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/messages/dsa_elgamal_1024.priv.asc (renamed from src/mailman_pgp/pgp/tests/data/dsa_elgamal_1024.priv.asc) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/messages/dsa_elgamal_1024.pub.asc (renamed from src/mailman_pgp/pgp/tests/data/dsa_elgamal_1024.pub.asc) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/messages/inline_cleartext_signed.eml (renamed from src/mailman_pgp/pgp/tests/data/inline_cleartext_signed.eml) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/messages/inline_cleartext_signed_invalid.eml (renamed from src/mailman_pgp/pgp/tests/data/inline_cleartext_signed_invalid.eml) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/messages/inline_encrypted.eml (renamed from src/mailman_pgp/pgp/tests/data/inline_encrypted.eml) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/messages/inline_privkey.eml (renamed from src/mailman_pgp/pgp/tests/data/inline_privkey.eml) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/messages/inline_pubkey.eml (renamed from src/mailman_pgp/pgp/tests/data/inline_pubkey.eml) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/messages/inline_signed.eml (renamed from src/mailman_pgp/pgp/tests/data/inline_signed.eml) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/messages/inline_signed_corrupted.eml (renamed from src/mailman_pgp/pgp/tests/data/inline_signed_corrupted.eml) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/messages/mime_encrypted.eml (renamed from src/mailman_pgp/pgp/tests/data/mime_encrypted.eml) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/messages/mime_encrypted_signed.eml (renamed from src/mailman_pgp/pgp/tests/data/mime_encrypted_signed.eml) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/messages/mime_encrypted_then_signed.eml (renamed from src/mailman_pgp/pgp/tests/data/mime_encrypted_then_signed.eml) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/messages/mime_privkey.eml (renamed from src/mailman_pgp/pgp/tests/data/mime_privkey.eml) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/messages/mime_pubkey.eml (renamed from src/mailman_pgp/pgp/tests/data/mime_pubkey.eml) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/messages/mime_signed.eml (renamed from src/mailman_pgp/pgp/tests/data/mime_signed.eml) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/data/messages/mime_signed_invalid.eml (renamed from src/mailman_pgp/pgp/tests/data/mime_signed_invalid.eml) | 0 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/test_inline.py | 102 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/test_mime.py | 86 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/tests/test_wrapper.py | 110 |
25 files changed, 159 insertions, 155 deletions
diff --git a/src/mailman_pgp/pgp/tests/base.py b/src/mailman_pgp/pgp/tests/base.py index 2f8d406..d561fda 100644 --- a/src/mailman_pgp/pgp/tests/base.py +++ b/src/mailman_pgp/pgp/tests/base.py @@ -16,22 +16,26 @@ # this program. If not, see <http://www.gnu.org/licenses/>. """""" -from email import message_from_file + +import os +from email import message_from_bytes from unittest import TestCase from mailman.email.message import Message from pgpy import PGPKey -from pkg_resources import resource_filename +from pkg_resources import resource_string def load_message(path): - with open(resource_filename('mailman_pgp.pgp.tests', path)) as f: - return message_from_file(f, Message) + data = resource_string('mailman_pgp.pgp.tests', + os.path.join('data', 'messages', path)) + return message_from_bytes(data, Message) def load_key(path): - key, _ = PGPKey.from_file( - resource_filename('mailman_pgp.pgp.tests', path)) + key, _ = PGPKey.from_blob( + resource_string('mailman_pgp.pgp.tests', + os.path.join('data', 'keys', path))) return key diff --git a/src/mailman_pgp/pgp/tests/data/ecc_p256.priv.asc b/src/mailman_pgp/pgp/tests/data/keys/ecc_p256.priv.asc index b591afc..b591afc 100644 --- a/src/mailman_pgp/pgp/tests/data/ecc_p256.priv.asc +++ b/src/mailman_pgp/pgp/tests/data/keys/ecc_p256.priv.asc diff --git a/src/mailman_pgp/pgp/tests/data/ecc_p256.pub.asc b/src/mailman_pgp/pgp/tests/data/keys/ecc_p256.pub.asc index 92cafc7..92cafc7 100644 --- a/src/mailman_pgp/pgp/tests/data/ecc_p256.pub.asc +++ b/src/mailman_pgp/pgp/tests/data/keys/ecc_p256.pub.asc diff --git a/src/mailman_pgp/pgp/tests/data/rsa_1024.priv.asc b/src/mailman_pgp/pgp/tests/data/keys/rsa_1024.priv.asc index e8f4c12..e8f4c12 100644 --- a/src/mailman_pgp/pgp/tests/data/rsa_1024.priv.asc +++ b/src/mailman_pgp/pgp/tests/data/keys/rsa_1024.priv.asc diff --git a/src/mailman_pgp/pgp/tests/data/rsa_1024.pub.asc b/src/mailman_pgp/pgp/tests/data/keys/rsa_1024.pub.asc index 5bc0d34..5bc0d34 100644 --- a/src/mailman_pgp/pgp/tests/data/rsa_1024.pub.asc +++ b/src/mailman_pgp/pgp/tests/data/keys/rsa_1024.pub.asc diff --git a/src/mailman_pgp/pgp/tests/data/clear.eml b/src/mailman_pgp/pgp/tests/data/messages/clear.eml index 55e35b3..55e35b3 100644 --- a/src/mailman_pgp/pgp/tests/data/clear.eml +++ b/src/mailman_pgp/pgp/tests/data/messages/clear.eml diff --git a/src/mailman_pgp/pgp/tests/data/dsa_elgamal_1024.priv.asc b/src/mailman_pgp/pgp/tests/data/messages/dsa_elgamal_1024.priv.asc index 34ed61d..34ed61d 100644 --- a/src/mailman_pgp/pgp/tests/data/dsa_elgamal_1024.priv.asc +++ b/src/mailman_pgp/pgp/tests/data/messages/dsa_elgamal_1024.priv.asc diff --git a/src/mailman_pgp/pgp/tests/data/dsa_elgamal_1024.pub.asc b/src/mailman_pgp/pgp/tests/data/messages/dsa_elgamal_1024.pub.asc index 51625d9..51625d9 100644 --- a/src/mailman_pgp/pgp/tests/data/dsa_elgamal_1024.pub.asc +++ b/src/mailman_pgp/pgp/tests/data/messages/dsa_elgamal_1024.pub.asc diff --git a/src/mailman_pgp/pgp/tests/data/inline_cleartext_signed.eml b/src/mailman_pgp/pgp/tests/data/messages/inline_cleartext_signed.eml index cb6d40c..cb6d40c 100644 --- a/src/mailman_pgp/pgp/tests/data/inline_cleartext_signed.eml +++ b/src/mailman_pgp/pgp/tests/data/messages/inline_cleartext_signed.eml diff --git a/src/mailman_pgp/pgp/tests/data/inline_cleartext_signed_invalid.eml b/src/mailman_pgp/pgp/tests/data/messages/inline_cleartext_signed_invalid.eml index c7d9b03..c7d9b03 100644 --- a/src/mailman_pgp/pgp/tests/data/inline_cleartext_signed_invalid.eml +++ b/src/mailman_pgp/pgp/tests/data/messages/inline_cleartext_signed_invalid.eml diff --git a/src/mailman_pgp/pgp/tests/data/inline_encrypted.eml b/src/mailman_pgp/pgp/tests/data/messages/inline_encrypted.eml index 1c75042..1c75042 100644 --- a/src/mailman_pgp/pgp/tests/data/inline_encrypted.eml +++ b/src/mailman_pgp/pgp/tests/data/messages/inline_encrypted.eml diff --git a/src/mailman_pgp/pgp/tests/data/inline_privkey.eml b/src/mailman_pgp/pgp/tests/data/messages/inline_privkey.eml index 683efdd..683efdd 100644 --- a/src/mailman_pgp/pgp/tests/data/inline_privkey.eml +++ b/src/mailman_pgp/pgp/tests/data/messages/inline_privkey.eml diff --git a/src/mailman_pgp/pgp/tests/data/inline_pubkey.eml b/src/mailman_pgp/pgp/tests/data/messages/inline_pubkey.eml index cb0d176..cb0d176 100644 --- a/src/mailman_pgp/pgp/tests/data/inline_pubkey.eml +++ b/src/mailman_pgp/pgp/tests/data/messages/inline_pubkey.eml diff --git a/src/mailman_pgp/pgp/tests/data/inline_signed.eml b/src/mailman_pgp/pgp/tests/data/messages/inline_signed.eml index f8adc02..f8adc02 100644 --- a/src/mailman_pgp/pgp/tests/data/inline_signed.eml +++ b/src/mailman_pgp/pgp/tests/data/messages/inline_signed.eml diff --git a/src/mailman_pgp/pgp/tests/data/inline_signed_corrupted.eml b/src/mailman_pgp/pgp/tests/data/messages/inline_signed_corrupted.eml index bd732fc..bd732fc 100644 --- a/src/mailman_pgp/pgp/tests/data/inline_signed_corrupted.eml +++ b/src/mailman_pgp/pgp/tests/data/messages/inline_signed_corrupted.eml diff --git a/src/mailman_pgp/pgp/tests/data/mime_encrypted.eml b/src/mailman_pgp/pgp/tests/data/messages/mime_encrypted.eml index 3199526..3199526 100644 --- a/src/mailman_pgp/pgp/tests/data/mime_encrypted.eml +++ b/src/mailman_pgp/pgp/tests/data/messages/mime_encrypted.eml diff --git a/src/mailman_pgp/pgp/tests/data/mime_encrypted_signed.eml b/src/mailman_pgp/pgp/tests/data/messages/mime_encrypted_signed.eml index 57a6afd..57a6afd 100644 --- a/src/mailman_pgp/pgp/tests/data/mime_encrypted_signed.eml +++ b/src/mailman_pgp/pgp/tests/data/messages/mime_encrypted_signed.eml diff --git a/src/mailman_pgp/pgp/tests/data/mime_encrypted_then_signed.eml b/src/mailman_pgp/pgp/tests/data/messages/mime_encrypted_then_signed.eml index 2a350ab..2a350ab 100644 --- a/src/mailman_pgp/pgp/tests/data/mime_encrypted_then_signed.eml +++ b/src/mailman_pgp/pgp/tests/data/messages/mime_encrypted_then_signed.eml diff --git a/src/mailman_pgp/pgp/tests/data/mime_privkey.eml b/src/mailman_pgp/pgp/tests/data/messages/mime_privkey.eml index da66247..da66247 100644 --- a/src/mailman_pgp/pgp/tests/data/mime_privkey.eml +++ b/src/mailman_pgp/pgp/tests/data/messages/mime_privkey.eml diff --git a/src/mailman_pgp/pgp/tests/data/mime_pubkey.eml b/src/mailman_pgp/pgp/tests/data/messages/mime_pubkey.eml index 1495a41..1495a41 100644 --- a/src/mailman_pgp/pgp/tests/data/mime_pubkey.eml +++ b/src/mailman_pgp/pgp/tests/data/messages/mime_pubkey.eml diff --git a/src/mailman_pgp/pgp/tests/data/mime_signed.eml b/src/mailman_pgp/pgp/tests/data/messages/mime_signed.eml index c81ecf5..c81ecf5 100644 --- a/src/mailman_pgp/pgp/tests/data/mime_signed.eml +++ b/src/mailman_pgp/pgp/tests/data/messages/mime_signed.eml diff --git a/src/mailman_pgp/pgp/tests/data/mime_signed_invalid.eml b/src/mailman_pgp/pgp/tests/data/messages/mime_signed_invalid.eml index 5e86842..5e86842 100644 --- a/src/mailman_pgp/pgp/tests/data/mime_signed_invalid.eml +++ b/src/mailman_pgp/pgp/tests/data/messages/mime_signed_invalid.eml diff --git a/src/mailman_pgp/pgp/tests/test_inline.py b/src/mailman_pgp/pgp/tests/test_inline.py index 900d5b2..cd18209 100644 --- a/src/mailman_pgp/pgp/tests/test_inline.py +++ b/src/mailman_pgp/pgp/tests/test_inline.py @@ -29,54 +29,54 @@ class InlineWrapperTestCase(WrapperTestCase): class TestSigning(InlineWrapperTestCase): @parameterized.expand([ - (load_message('data/inline_cleartext_signed.eml'), + (load_message('inline_cleartext_signed.eml'), True), - (load_message('data/inline_cleartext_signed_invalid.eml'), + (load_message('inline_cleartext_signed_invalid.eml'), True), - (load_message('data/inline_signed.eml'), + (load_message('inline_signed.eml'), True), - (load_message('data/inline_signed_corrupted.eml'), + (load_message('inline_signed_corrupted.eml'), False), - (load_message('data/clear.eml'), + (load_message('clear.eml'), False), - (load_message('data/inline_encrypted.eml'), + (load_message('inline_encrypted.eml'), False) ]) def test_is_signed(self, message, signed): super().is_signed(message, signed) @parameterized.expand([ - (load_message('data/clear.eml'), - load_key('data/rsa_1024.priv.asc')), - (load_message('data/clear.eml'), - load_key('data/ecc_p256.priv.asc')) + (load_message('clear.eml'), + load_key('rsa_1024.priv.asc')), + (load_message('clear.eml'), + load_key('ecc_p256.priv.asc')) ]) def test_sign(self, message, key): super().sign(message, key) @parameterized.expand([ - (load_message('data/clear.eml'), - load_key('data/rsa_1024.priv.asc'), - load_key('data/rsa_1024.pub.asc')), - (load_message('data/clear.eml'), - load_key('data/ecc_p256.priv.asc'), - load_key('data/ecc_p256.pub.asc')) + (load_message('clear.eml'), + load_key('rsa_1024.priv.asc'), + load_key('rsa_1024.pub.asc')), + (load_message('clear.eml'), + load_key('ecc_p256.priv.asc'), + load_key('ecc_p256.pub.asc')) ]) def test_sign_verify(self, message, priv, pub): super().sign_verify(message, priv, pub) @parameterized.expand([ - (load_message('data/inline_cleartext_signed.eml'), - load_key('data/rsa_1024.pub.asc'), + (load_message('inline_cleartext_signed.eml'), + load_key('rsa_1024.pub.asc'), True), - (load_message('data/inline_cleartext_signed_invalid.eml'), - load_key('data/rsa_1024.pub.asc'), + (load_message('inline_cleartext_signed_invalid.eml'), + load_key('rsa_1024.pub.asc'), False), - (load_message('data/inline_signed.eml'), - load_key('data/rsa_1024.pub.asc'), + (load_message('inline_signed.eml'), + load_key('rsa_1024.pub.asc'), True), - (load_message('data/inline_signed_corrupted.eml'), - load_key('data/rsa_1024.pub.asc'), + (load_message('inline_signed_corrupted.eml'), + load_key('rsa_1024.pub.asc'), False), ]) def test_verify(self, message, key, valid): @@ -85,28 +85,28 @@ class TestSigning(InlineWrapperTestCase): class TestEncryption(InlineWrapperTestCase): @parameterized.expand([ - (load_message('data/inline_encrypted.eml'), + (load_message('inline_encrypted.eml'), True), - (load_message('data/inline_cleartext_signed.eml'), + (load_message('inline_cleartext_signed.eml'), False), - (load_message('data/inline_cleartext_signed_invalid.eml'), + (load_message('inline_cleartext_signed_invalid.eml'), False), - (load_message('data/inline_signed.eml'), + (load_message('inline_signed.eml'), False), - (load_message('data/inline_signed_corrupted.eml'), + (load_message('inline_signed_corrupted.eml'), False), - (load_message('data/clear.eml'), + (load_message('clear.eml'), False) ]) def test_is_encrypted(self, message, encrypted): super().is_encrypted(message, encrypted) @parameterized.expand([ - (load_message('data/clear.eml'), - load_key('data/rsa_1024.pub.asc')), - (load_message('data/clear.eml'), - (load_key('data/rsa_1024.pub.asc'), - load_key('data/ecc_p256.pub.asc'))) + (load_message('clear.eml'), + load_key('rsa_1024.pub.asc')), + (load_message('clear.eml'), + (load_key('rsa_1024.pub.asc'), + load_key('ecc_p256.pub.asc'))) ]) def test_encrypt(self, message, keys, **kwargs): if isinstance(keys, tuple): @@ -115,19 +115,19 @@ class TestEncryption(InlineWrapperTestCase): super().encrypt(message, keys, **kwargs) @parameterized.expand([ - (load_message('data/clear.eml'), - load_key('data/rsa_1024.pub.asc'), - load_key('data/rsa_1024.priv.asc')), - (load_message('data/clear.eml'), - load_key('data/ecc_p256.pub.asc'), - load_key('data/ecc_p256.priv.asc')) + (load_message('clear.eml'), + load_key('rsa_1024.pub.asc'), + load_key('rsa_1024.priv.asc')), + (load_message('clear.eml'), + load_key('ecc_p256.pub.asc'), + load_key('ecc_p256.priv.asc')) ]) def test_encrypt_decrypt(self, message, pub, priv): super().encrypt_decrypt(message, pub, priv) @parameterized.expand([ - (load_message('data/inline_encrypted.eml'), - load_key('data/rsa_1024.priv.asc'), + (load_message('inline_encrypted.eml'), + load_key('rsa_1024.priv.asc'), 'Some encrypted text.\n\n') ]) def test_decrypt(self, message, key, clear): @@ -136,23 +136,23 @@ class TestEncryption(InlineWrapperTestCase): class TestKeys(InlineWrapperTestCase): @parameterized.expand([ - (load_message('data/inline_privkey.eml'), + (load_message('inline_privkey.eml'), True), - (load_message('data/inline_pubkey.eml'), + (load_message('inline_pubkey.eml'), True), - (load_message('data/clear.eml'), + (load_message('clear.eml'), False), - (load_message('data/inline_cleartext_signed.eml'), + (load_message('inline_cleartext_signed.eml'), False) ]) def test_has_keys(self, message, has_keys): super().has_keys(message, has_keys) @parameterized.expand([ - (load_message('data/inline_privkey.eml'), - [load_key('data/rsa_1024.priv.asc')]), - (load_message('data/inline_pubkey.eml'), - [load_key('data/rsa_1024.pub.asc')]) + (load_message('inline_privkey.eml'), + [load_key('rsa_1024.priv.asc')]), + (load_message('inline_pubkey.eml'), + [load_key('rsa_1024.pub.asc')]) ]) def test_keys(self, message, keys): super().keys(message, keys) diff --git a/src/mailman_pgp/pgp/tests/test_mime.py b/src/mailman_pgp/pgp/tests/test_mime.py index 7243e06..fab50bb 100644 --- a/src/mailman_pgp/pgp/tests/test_mime.py +++ b/src/mailman_pgp/pgp/tests/test_mime.py @@ -29,42 +29,42 @@ class MIMEWrapperTestCase(WrapperTestCase): class TestSigning(MIMEWrapperTestCase): @parameterized.expand([ - (load_message('data/mime_signed.eml'), + (load_message('mime_signed.eml'), True), - (load_message('data/mime_signed_invalid.eml'), + (load_message('mime_signed_invalid.eml'), True), - (load_message('data/clear.eml'), + (load_message('clear.eml'), False) ]) def test_is_signed(self, message, signed): super().is_signed(message, signed) @parameterized.expand([ - (load_message('data/clear.eml'), - load_key('data/rsa_1024.priv.asc')), - (load_message('data/clear.eml'), - load_key('data/ecc_p256.priv.asc')) + (load_message('clear.eml'), + load_key('rsa_1024.priv.asc')), + (load_message('clear.eml'), + load_key('ecc_p256.priv.asc')) ]) def test_sign(self, message, key): super().sign(message, key) @parameterized.expand([ - (load_message('data/clear.eml'), - load_key('data/rsa_1024.priv.asc'), - load_key('data/rsa_1024.pub.asc')), - (load_message('data/clear.eml'), - load_key('data/ecc_p256.priv.asc'), - load_key('data/ecc_p256.pub.asc')) + (load_message('clear.eml'), + load_key('rsa_1024.priv.asc'), + load_key('rsa_1024.pub.asc')), + (load_message('clear.eml'), + load_key('ecc_p256.priv.asc'), + load_key('ecc_p256.pub.asc')) ]) def test_sign_verify(self, message, priv, pub): super().sign_verify(message, priv, pub) @parameterized.expand([ - (load_message('data/mime_signed.eml'), - load_key('data/rsa_1024.pub.asc'), + (load_message('mime_signed.eml'), + load_key('rsa_1024.pub.asc'), True), - (load_message('data/mime_signed_invalid.eml'), - load_key('data/rsa_1024.pub.asc'), + (load_message('mime_signed_invalid.eml'), + load_key('rsa_1024.pub.asc'), False) ]) def test_verify(self, message, key, valid): @@ -73,20 +73,20 @@ class TestSigning(MIMEWrapperTestCase): class TestEncryption(MIMEWrapperTestCase): @parameterized.expand([ - (load_message('data/mime_encrypted.eml'), + (load_message('mime_encrypted.eml'), True), - (load_message('data/mime_encrypted_then_signed.eml'), + (load_message('mime_encrypted_then_signed.eml'), True) ]) def test_is_encrypted(self, message, encrypted): super().is_encrypted(message, encrypted) @parameterized.expand([ - (load_message('data/clear.eml'), - load_key('data/rsa_1024.pub.asc')), - (load_message('data/clear.eml'), - (load_key('data/rsa_1024.pub.asc'), - load_key('data/ecc_p256.pub.asc'))) + (load_message('clear.eml'), + load_key('rsa_1024.pub.asc')), + (load_message('clear.eml'), + (load_key('rsa_1024.pub.asc'), + load_key('ecc_p256.pub.asc'))) ]) def test_encrypt(self, message, keys, **kwargs): if isinstance(keys, tuple): @@ -95,19 +95,19 @@ class TestEncryption(MIMEWrapperTestCase): super().encrypt(message, keys, **kwargs) @parameterized.expand([ - (load_message('data/clear.eml'), - load_key('data/rsa_1024.pub.asc'), - load_key('data/rsa_1024.priv.asc')), - (load_message('data/clear.eml'), - load_key('data/ecc_p256.pub.asc'), - load_key('data/ecc_p256.priv.asc')) + (load_message('clear.eml'), + load_key('rsa_1024.pub.asc'), + load_key('rsa_1024.priv.asc')), + (load_message('clear.eml'), + load_key('ecc_p256.pub.asc'), + load_key('ecc_p256.priv.asc')) ]) def test_encrypt_decrypt(self, message, pub, priv): super().encrypt_decrypt(message, pub, priv) @parameterized.expand([ - (load_message('data/mime_encrypted.eml'), - load_key('data/rsa_1024.priv.asc'), + (load_message('mime_encrypted.eml'), + load_key('rsa_1024.priv.asc'), 'Some encrypted text.\n') ]) def test_decrypt(self, message, key, clear): @@ -116,23 +116,23 @@ class TestEncryption(MIMEWrapperTestCase): class TestKeys(MIMEWrapperTestCase): @parameterized.expand([ - (load_message('data/mime_privkey.eml'), + (load_message('mime_privkey.eml'), True), - (load_message('data/mime_pubkey.eml'), + (load_message('mime_pubkey.eml'), True), - (load_message('data/clear.eml'), + (load_message('clear.eml'), False), - (load_message('data/mime_signed.eml'), + (load_message('mime_signed.eml'), False) ]) def test_has_keys(self, message, has_keys): super().has_keys(message, has_keys) @parameterized.expand([ - (load_message('data/mime_privkey.eml'), - [load_key('data/rsa_1024.priv.asc')]), - (load_message('data/mime_pubkey.eml'), - [load_key('data/rsa_1024.pub.asc')]) + (load_message('mime_privkey.eml'), + [load_key('rsa_1024.priv.asc')]), + (load_message('mime_pubkey.eml'), + [load_key('rsa_1024.pub.asc')]) ]) def test_keys(self, message, keys): super().keys(message, keys) @@ -140,9 +140,9 @@ class TestKeys(MIMEWrapperTestCase): class TestCombined(MIMEWrapperTestCase): @parameterized.expand([ - (load_message('data/clear.eml'), - load_key('data/rsa_1024.priv.asc'), - load_key('data/ecc_p256.priv.asc')) + (load_message('clear.eml'), + load_key('rsa_1024.priv.asc'), + load_key('ecc_p256.priv.asc')) ]) def test_sign_encrypt_decrypt_verify(self, message, sign_key, encrypt_key): super().sign_encrypt_decrypt_verify(message, sign_key, encrypt_key) diff --git a/src/mailman_pgp/pgp/tests/test_wrapper.py b/src/mailman_pgp/pgp/tests/test_wrapper.py index 1c55ed2..fb7f0bb 100644 --- a/src/mailman_pgp/pgp/tests/test_wrapper.py +++ b/src/mailman_pgp/pgp/tests/test_wrapper.py @@ -28,47 +28,47 @@ class PGPWrapperTestCase(WrapperTestCase): class TestSigning(PGPWrapperTestCase): @parameterized.expand([ - (load_message('data/inline_cleartext_signed.eml'), + (load_message('inline_cleartext_signed.eml'), True), - (load_message('data/inline_cleartext_signed_invalid.eml'), + (load_message('inline_cleartext_signed_invalid.eml'), True), - (load_message('data/inline_encrypted.eml'), + (load_message('inline_encrypted.eml'), False), - (load_message('data/inline_signed.eml'), + (load_message('inline_signed.eml'), True), - (load_message('data/inline_signed_corrupted.eml'), + (load_message('inline_signed_corrupted.eml'), False), - (load_message('data/mime_signed.eml'), + (load_message('mime_signed.eml'), True), - (load_message('data/mime_signed_invalid.eml'), + (load_message('mime_signed_invalid.eml'), True), - (load_message('data/clear.eml'), + (load_message('clear.eml'), False) ]) def test_is_signed(self, message, signed): super().is_signed(message, signed) @parameterized.expand([ - (load_message('data/clear.eml'), - load_key('data/rsa_1024.priv.asc')), - (load_message('data/clear.eml'), - load_key('data/ecc_p256.priv.asc')) + (load_message('clear.eml'), + load_key('rsa_1024.priv.asc')), + (load_message('clear.eml'), + load_key('ecc_p256.priv.asc')) ]) def test_sign(self, message, key): super().sign(message, key) @parameterized.expand([ - (load_message('data/inline_cleartext_signed.eml'), - load_key('data/rsa_1024.pub.asc'), + (load_message('inline_cleartext_signed.eml'), + load_key('rsa_1024.pub.asc'), True), - (load_message('data/inline_cleartext_signed_invalid.eml'), - load_key('data/rsa_1024.pub.asc'), + (load_message('inline_cleartext_signed_invalid.eml'), + load_key('rsa_1024.pub.asc'), False), - (load_message('data/mime_signed.eml'), - load_key('data/rsa_1024.pub.asc'), + (load_message('mime_signed.eml'), + load_key('rsa_1024.pub.asc'), True), - (load_message('data/mime_signed_invalid.eml'), - load_key('data/rsa_1024.pub.asc'), + (load_message('mime_signed_invalid.eml'), + load_key('rsa_1024.pub.asc'), False) ]) def test_verify(self, message, key, valid): @@ -77,30 +77,30 @@ class TestSigning(PGPWrapperTestCase): class TestEncryption(PGPWrapperTestCase): @parameterized.expand([ - (load_message('data/inline_encrypted.eml'), + (load_message('inline_encrypted.eml'), True), - (load_message('data/mime_encrypted_then_signed.eml'), + (load_message('mime_encrypted_then_signed.eml'), True), - (load_message('data/inline_cleartext_signed.eml'), + (load_message('inline_cleartext_signed.eml'), False), - (load_message('data/inline_cleartext_signed_invalid.eml'), + (load_message('inline_cleartext_signed_invalid.eml'), False), - (load_message('data/inline_signed.eml'), + (load_message('inline_signed.eml'), False), - (load_message('data/inline_signed_corrupted.eml'), + (load_message('inline_signed_corrupted.eml'), False), - (load_message('data/clear.eml'), + (load_message('clear.eml'), False) ]) def test_is_encrypted(self, message, encrypted): super().is_encrypted(message, encrypted) @parameterized.expand([ - (load_message('data/clear.eml'), - load_key('data/rsa_1024.pub.asc')), - (load_message('data/clear.eml'), - (load_key('data/rsa_1024.pub.asc'), - load_key('data/ecc_p256.pub.asc'))) + (load_message('clear.eml'), + load_key('rsa_1024.pub.asc')), + (load_message('clear.eml'), + (load_key('rsa_1024.pub.asc'), + load_key('ecc_p256.pub.asc'))) ]) def test_encrypt(self, message, keys, **kwargs): if isinstance(keys, tuple): @@ -109,19 +109,19 @@ class TestEncryption(PGPWrapperTestCase): super().encrypt(message, keys, **kwargs) @parameterized.expand([ - (load_message('data/clear.eml'), - load_key('data/rsa_1024.pub.asc'), - load_key('data/rsa_1024.priv.asc')), - (load_message('data/clear.eml'), - load_key('data/ecc_p256.pub.asc'), - load_key('data/ecc_p256.priv.asc')) + (load_message('clear.eml'), + load_key('rsa_1024.pub.asc'), + load_key('rsa_1024.priv.asc')), + (load_message('clear.eml'), + load_key('ecc_p256.pub.asc'), + load_key('ecc_p256.priv.asc')) ]) def test_encrypt_decrypt(self, message, pub, priv): super().encrypt_decrypt(message, pub, priv) @parameterized.expand([ - (load_message('data/inline_encrypted.eml'), - load_key('data/rsa_1024.priv.asc'), + (load_message('inline_encrypted.eml'), + load_key('rsa_1024.priv.asc'), 'Some encrypted text.\n\n') ]) def test_decrypt(self, message, key, clear): @@ -130,33 +130,33 @@ class TestEncryption(PGPWrapperTestCase): class TestKeys(PGPWrapperTestCase): @parameterized.expand([ - (load_message('data/inline_privkey.eml'), + (load_message('inline_privkey.eml'), True), - (load_message('data/inline_pubkey.eml'), + (load_message('inline_pubkey.eml'), True), - (load_message('data/inline_cleartext_signed.eml'), + (load_message('inline_cleartext_signed.eml'), False), - (load_message('data/mime_privkey.eml'), + (load_message('mime_privkey.eml'), True), - (load_message('data/mime_pubkey.eml'), + (load_message('mime_pubkey.eml'), True), - (load_message('data/mime_signed.eml'), + (load_message('mime_signed.eml'), False), - (load_message('data/clear.eml'), + (load_message('clear.eml'), False) ]) def test_has_keys(self, message, has_keys): super().has_keys(message, has_keys) @parameterized.expand([ - (load_message('data/inline_privkey.eml'), - [load_key('data/rsa_1024.priv.asc')]), - (load_message('data/inline_pubkey.eml'), - [load_key('data/rsa_1024.pub.asc')]), - (load_message('data/mime_privkey.eml'), - [load_key('data/rsa_1024.priv.asc')]), - (load_message('data/mime_pubkey.eml'), - [load_key('data/rsa_1024.pub.asc')]) + (load_message('inline_privkey.eml'), + [load_key('rsa_1024.priv.asc')]), + (load_message('inline_pubkey.eml'), + [load_key('rsa_1024.pub.asc')]), + (load_message('mime_privkey.eml'), + [load_key('rsa_1024.priv.asc')]), + (load_message('mime_pubkey.eml'), + [load_key('rsa_1024.pub.asc')]) ]) def test_keys(self, message, keys): super().keys(message, keys) |
