summaryrefslogtreecommitdiff
path: root/lang/python/tests/t-keylist.py
diff options
context:
space:
mode:
Diffstat (limited to 'lang/python/tests/t-keylist.py')
-rwxr-xr-xlang/python/tests/t-keylist.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/lang/python/tests/t-keylist.py b/lang/python/tests/t-keylist.py
index f7f6674..ea2a724 100755
--- a/lang/python/tests/t-keylist.py
+++ b/lang/python/tests/t-keylist.py
@@ -20,12 +20,11 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
-from pyme import core, constants
+import gpg
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], \
@@ -248,7 +247,7 @@ for i, key in enumerate(c.keylist()):
# check get_key()
-with pyme.Context() as c:
+with gpg.Context() as c:
c.get_key(support.alpha)
c.get_key(support.alpha, secret=True)
@@ -263,7 +262,7 @@ with pyme.Context() as c:
# Legacy error
try:
c.get_key(support.no_such_key)
- except pyme.errors.GPGMEError:
+ except gpg.errors.GPGMEError:
pass
else:
assert False, "Expected GPGMEError"