diff options
author | Justus Winter <[email protected]> | 2016-10-31 14:28:26 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2016-10-31 14:42:35 +0000 |
commit | 4b3264345084a0c9bf9f97fb233df700d7608e66 (patch) | |
tree | cecaf14d620fee63b54de2d095dca4b24a79d51d /lang/python/tests/t-keylist.py | |
parent | python: Import the topmost module in tests and examples. (diff) | |
download | gpgme-4b3264345084a0c9bf9f97fb233df700d7608e66.tar.gz gpgme-4b3264345084a0c9bf9f97fb233df700d7608e66.zip |
python: Use vanity modules for constants in tests and examples.
* lang/python/gpg/constants/sig/notation.py: New file.
* lang/python/gpg/constants/sig/__init__.py: Import new module.
* lang/python/examples/assuan.py: Use more specific module for
constants, e.g. 'protocol.ASSUAN' instead of 'PROTOCOL_ASSUAN'.
* lang/python/examples/testCMSgetkey.py: Likewise.
* lang/python/tests/initial.py: Likewise.
* lang/python/tests/t-callbacks.py: Likewise.
* lang/python/tests/t-decrypt-verify.py: Likewise.
* lang/python/tests/t-decrypt.py: Likewise.
* lang/python/tests/t-edit.py: Likewise.
* lang/python/tests/t-encrypt-large.py: Likewise.
* lang/python/tests/t-encrypt-sign.py: Likewise.
* lang/python/tests/t-encrypt-sym.py: Likewise.
* lang/python/tests/t-encrypt.py: Likewise.
* lang/python/tests/t-export.py: Likewise.
* lang/python/tests/t-file-name.py: Likewise.
* lang/python/tests/t-idiomatic.py: Likewise.
* lang/python/tests/t-import.py: Likewise.
* lang/python/tests/t-keylist.py: Likewise.
* lang/python/tests/t-protocol-assuan.py: Likewise.
* lang/python/tests/t-sig-notation.py: Likewise.
* lang/python/tests/t-sign.py: Likewise.
* lang/python/tests/t-signers.py: Likewise.
* lang/python/tests/t-trustlist.py: Likewise.
* lang/python/tests/t-verify.py: Likewise.
* lang/python/tests/t-wait.py: Likewise.
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'lang/python/tests/t-keylist.py')
-rwxr-xr-x | lang/python/tests/t-keylist.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lang/python/tests/t-keylist.py b/lang/python/tests/t-keylist.py index a7259419..ea2a7240 100755 --- a/lang/python/tests/t-keylist.py +++ b/lang/python/tests/t-keylist.py @@ -23,7 +23,7 @@ del absolute_import, print_function, unicode_literals import gpg import support -support.init_gpgme(gpg.constants.PROTOCOL_OpenPGP) +support.init_gpgme(gpg.constants.protocol.OpenPGP) c = gpg.Context() # Check expration of keys. This test assumes three subkeys of which @@ -108,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 != gpg.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) @@ -119,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 == gpg.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 == gpg.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, \ @@ -153,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 != (gpg.constants.PK_DSA if which == "Primary" - else gpg.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, \ @@ -169,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 == (gpg.constants.VALIDITY_UNKNOWN + assert uid.validity == (gpg.constants.validity.UNKNOWN if uid.name.split()[0] not in {'Alfa', 'Alpha', 'Alice'} else - gpg.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], \ |