diff options
Diffstat (limited to 'lang/python/tests/t-keylist.py')
-rwxr-xr-x | lang/python/tests/t-keylist.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lang/python/tests/t-keylist.py b/lang/python/tests/t-keylist.py index 8dd12ae6..a7259419 100755 --- a/lang/python/tests/t-keylist.py +++ b/lang/python/tests/t-keylist.py @@ -21,11 +21,10 @@ from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals import gpg -from gpg import core, constants import support -support.init_gpgme(constants.PROTOCOL_OpenPGP) -c = core.Context() +support.init_gpgme(gpg.constants.PROTOCOL_OpenPGP) +c = gpg.Context() # Check expration of keys. This test assumes three subkeys of which # 2 are expired; it is used with the "Whisky" test key. It has @@ -109,7 +108,7 @@ def check_global(key, uids, n_subkeys): assert key.can_sign, "Key unexpectedly unusable for signing" assert key.can_certify, "Key unexpectedly unusable for certifications" assert not key.secret, "Key unexpectedly secret" - assert not key.protocol != constants.PROTOCOL_OpenPGP, \ + assert not key.protocol != gpg.constants.PROTOCOL_OpenPGP, \ "Key has unexpected protocol: {}".format(key.protocol) assert not key.issuer_serial, \ "Key unexpectedly carries issuer serial: {}".format(key.issuer_serial) @@ -120,10 +119,10 @@ def check_global(key, uids, n_subkeys): # Only key Alfa is trusted assert key.uids[0].name == 'Alfa Test' \ - or key.owner_trust == constants.VALIDITY_UNKNOWN, \ + or key.owner_trust == gpg.constants.VALIDITY_UNKNOWN, \ "Key has unexpected owner trust: {}".format(key.owner_trust) assert key.uids[0].name != 'Alfa Test' \ - or key.owner_trust == constants.VALIDITY_ULTIMATE, \ + or key.owner_trust == gpg.constants.VALIDITY_ULTIMATE, \ "Key has unexpected owner trust: {}".format(key.owner_trust) assert len(key.subkeys) - 1 == n_subkeys, \ @@ -154,8 +153,8 @@ def check_subkey(fpr, which, subkey): assert not subkey.secret, which + " key unexpectedly secret" assert not subkey.is_cardkey, "Public key marked as card key" assert not subkey.card_number, "Public key with card number set" - assert not subkey.pubkey_algo != (constants.PK_DSA if which == "Primary" - else constants.PK_ELG_E), \ + assert not subkey.pubkey_algo != (gpg.constants.PK_DSA if which == "Primary" + else gpg.constants.PK_ELG_E), \ which + " key has unexpected public key algo: {}".\ format(subkey.pubkey_algo) assert subkey.length == 1024, \ @@ -170,10 +169,10 @@ def check_subkey(fpr, which, subkey): def check_uid(which, ref, uid): assert not uid.revoked, which + " user ID unexpectedly revoked" assert not uid.invalid, which + " user ID unexpectedly invalid" - assert uid.validity == (constants.VALIDITY_UNKNOWN + assert uid.validity == (gpg.constants.VALIDITY_UNKNOWN if uid.name.split()[0] not in {'Alfa', 'Alpha', 'Alice'} else - constants.VALIDITY_ULTIMATE), \ + gpg.constants.VALIDITY_ULTIMATE), \ which + " user ID has unexpectedly validity: {}".format(uid.validity) assert not uid.signatures, which + " user ID unexpectedly signed" assert uid.name == ref[0], \ |