aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/tests/t-keylist.py
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2016-10-31 13:42:26 +0000
committerJustus Winter <[email protected]>2016-10-31 14:42:35 +0000
commit20dc37a0e7e1531b0e568a6ec29b1c2d18de59c3 (patch)
tree27b9415a448303e9741cc2ee416c9a7598560755 /lang/python/tests/t-keylist.py
parentpython: Improve constants module. (diff)
downloadgpgme-20dc37a0e7e1531b0e568a6ec29b1c2d18de59c3.tar.gz
gpgme-20dc37a0e7e1531b0e568a6ec29b1c2d18de59c3.zip
python: Import the topmost module in tests and examples.
* examples/verifydetails.py: Only import the topmost module 'gpg' and update the code accordingly. * tests/support.py: Likewise. * tests/t-callbacks.py: Likewise. * tests/t-data.py: Likewise. * tests/t-decrypt-verify.py: Likewise. * tests/t-decrypt.py: Likewise. * tests/t-edit.py: Likewise. * tests/t-encrypt-large.py: Likewise. * tests/t-encrypt-sign.py: Likewise. * tests/t-encrypt-sym.py: Likewise. * tests/t-encrypt.py: Likewise. * tests/t-export.py: Likewise. * tests/t-file-name.py: Likewise. * tests/t-import.py: Likewise. * tests/t-keylist.py: Likewise. * tests/t-sig-notation.py: Likewise. * tests/t-sign.py: Likewise. * tests/t-signers.py: Likewise. * tests/t-trustlist.py: Likewise. * tests/t-verify.py: Likewise. * tests/t-wait.py: Likewise. * tests/t-wrapper.py: Likewise. Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'lang/python/tests/t-keylist.py')
-rwxr-xr-xlang/python/tests/t-keylist.py19
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], \