diff options
author | Michał Górny <mgorny@gentoo.org> | 2020-08-27 09:09:55 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2020-08-27 09:09:55 +0200 |
commit | 5dc6062495b053b7913d5ce01b00a7840dc6c1af (patch) | |
tree | e62d00f49a2ce201987493868f20b28348563fa5 /tests/test_openpgp.py | |
parent | 9c6aa465b3533281575aa077dab04c83e2b9c869 (diff) | |
download | gemato-5dc6062495b053b7913d5ce01b00a7840dc6c1af.tar.gz |
Add tests for keys lacking signatures
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'tests/test_openpgp.py')
-rw-r--r-- | tests/test_openpgp.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/test_openpgp.py b/tests/test_openpgp.py index 0037f41..0108ecd 100644 --- a/tests/test_openpgp.py +++ b/tests/test_openpgp.py @@ -193,6 +193,9 @@ FORGED_SUBKEY = (PUBLIC_KEY + UID + PUBLIC_KEY_SIG + PUBLIC_SUBKEY + FORGED_UNEXPIRE_KEY = (PUBLIC_KEY + EXPIRED_KEY_UID + EXPIRED_KEY_SIG + break_sig(UNEXPIRE_SIG)) +UNSIGNED_PUBLIC_KEY = PUBLIC_KEY + UID +UNSIGNED_SUBKEY = PUBLIC_KEY + UID + PUBLIC_KEY_SIG + PUBLIC_SUBKEY + def strip_openpgp(text): lines = text.lstrip().splitlines() @@ -463,7 +466,8 @@ EMPTY_DATA = b'' @pytest.mark.parametrize('key_var,success', [('VALID_PUBLIC_KEY', True), ('MALFORMED_PUBLIC_KEY', False), ('EMPTY_DATA', False), - ('FORGED_PUBLIC_KEY', False)]) + ('FORGED_PUBLIC_KEY', False), + ('UNSIGNED_PUBLIC_KEY', False)]) def test_env_import_key(openpgp_env, key_var, success): """Test importing valid and invalid keys""" try: @@ -619,6 +623,8 @@ REFRESH_VARIANTS = [ 'FORGED_UNEXPIRE_KEY', gemato.exceptions.OpenPGPExpiredKeyFailure), ('SUBKEY_SIGNED_MANIFEST', 'VALID_PUBLIC_KEY', KEY_FINGERPRINT, 'FORGED_SUBKEY', gemato.exceptions.OpenPGPVerificationFailure), + ('SUBKEY_SIGNED_MANIFEST', 'VALID_PUBLIC_KEY', KEY_FINGERPRINT, + 'UNSIGNED_SUBKEY', gemato.exceptions.OpenPGPVerificationFailure), ] |