aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/tests
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <[email protected]>2016-10-28 20:45:49 +0000
committerJustus Winter <[email protected]>2016-10-31 14:42:27 +0000
commit2fac017618a76882605125b05ff1f7393fe99860 (patch)
treeb7eddc17682b6aa91b8c3c723a2fc02f28ac0a6c /lang/python/tests
parentcore: New API functions gpgme_set_sender, gpgme_get_sender. (diff)
downloadgpgme-2fac017618a76882605125b05ff1f7393fe99860.tar.gz
gpgme-2fac017618a76882605125b05ff1f7393fe99860.zip
python: Rename Python module from PyME to gpg.
This follows weeks of discussion on the gnupg-devel mailing list. Hopefully it will make it easier for people using Python to use GnuPG in the future. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
Diffstat (limited to '')
-rwxr-xr-xlang/python/tests/initial.py6
-rw-r--r--lang/python/tests/support.py2
-rwxr-xr-xlang/python/tests/t-callbacks.py4
-rwxr-xr-xlang/python/tests/t-data.py2
-rwxr-xr-xlang/python/tests/t-decrypt-verify.py6
-rwxr-xr-xlang/python/tests/t-decrypt.py6
-rwxr-xr-xlang/python/tests/t-edit.py2
-rwxr-xr-xlang/python/tests/t-encrypt-large.py2
-rwxr-xr-xlang/python/tests/t-encrypt-sign.py8
-rwxr-xr-xlang/python/tests/t-encrypt-sym.py6
-rwxr-xr-xlang/python/tests/t-encrypt.py8
-rwxr-xr-xlang/python/tests/t-export.py2
-rwxr-xr-xlang/python/tests/t-file-name.py2
-rwxr-xr-xlang/python/tests/t-idiomatic.py18
-rwxr-xr-xlang/python/tests/t-import.py2
-rwxr-xr-xlang/python/tests/t-keylist.py8
-rwxr-xr-xlang/python/tests/t-protocol-assuan.py8
-rwxr-xr-xlang/python/tests/t-sig-notation.py2
-rwxr-xr-xlang/python/tests/t-sign.py14
-rwxr-xr-xlang/python/tests/t-signers.py6
-rwxr-xr-xlang/python/tests/t-trustlist.py2
-rwxr-xr-xlang/python/tests/t-verify.py6
-rwxr-xr-xlang/python/tests/t-wait.py2
-rwxr-xr-xlang/python/tests/t-wrapper.py2
24 files changed, 63 insertions, 63 deletions
diff --git a/lang/python/tests/initial.py b/lang/python/tests/initial.py
index 2d4827a0..a811a936 100755
--- a/lang/python/tests/initial.py
+++ b/lang/python/tests/initial.py
@@ -22,14 +22,14 @@ del absolute_import, print_function, unicode_literals
import os
import subprocess
-import pyme
+import gpg
import support
-support.init_gpgme(pyme.constants.PROTOCOL_OpenPGP)
+support.init_gpgme(gpg.constants.PROTOCOL_OpenPGP)
subprocess.check_call([os.path.join(os.getenv('top_srcdir'),
"tests", "start-stop-agent"), "--start"])
-with pyme.Context() as c:
+with gpg.Context() as c:
alpha = c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False)
bob = c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False)
diff --git a/lang/python/tests/support.py b/lang/python/tests/support.py
index f1ffdc38..280ed063 100644
--- a/lang/python/tests/support.py
+++ b/lang/python/tests/support.py
@@ -20,7 +20,7 @@ del absolute_import, print_function, unicode_literals
import sys
import os
-from pyme import core
+from gpg import core
# known keys
alpha = "A0FF4590BB6122EDEF6E3C542D727CC768697734"
diff --git a/lang/python/tests/t-callbacks.py b/lang/python/tests/t-callbacks.py
index b3b43497..ebe51fdf 100755
--- a/lang/python/tests/t-callbacks.py
+++ b/lang/python/tests/t-callbacks.py
@@ -21,7 +21,7 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import os
-from pyme import core, constants
+from gpg import core, constants
import support
support.init_gpgme(constants.PROTOCOL_OpenPGP)
@@ -87,7 +87,7 @@ Key-Type: RSA
Key-Length: 1024
Name-Real: Joe Tester
Name-Comment: with stupid passphrase
-Name-Email: [email protected]
+Name-Email: [email protected]
Passphrase: Crypt0R0cks
Expire-Date: 2020-12-31
</GnupgKeyParms>
diff --git a/lang/python/tests/t-data.py b/lang/python/tests/t-data.py
index 4812a2e7..16b2a7b5 100755
--- a/lang/python/tests/t-data.py
+++ b/lang/python/tests/t-data.py
@@ -23,7 +23,7 @@ del absolute_import, print_function, unicode_literals
import io
import os
import tempfile
-from pyme import core
+from gpg import core
data = core.Data('Hello world!')
assert data.read() == b'Hello world!'
diff --git a/lang/python/tests/t-decrypt-verify.py b/lang/python/tests/t-decrypt-verify.py
index a38a965b..aa5971b9 100755
--- a/lang/python/tests/t-decrypt-verify.py
+++ b/lang/python/tests/t-decrypt-verify.py
@@ -20,8 +20,8 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
-from pyme import core, constants, errors
+import gpg
+from gpg import core, constants, errors
import support
def check_verify_result(result, summary, fpr, status):
@@ -55,7 +55,7 @@ check_verify_result(verify_result,
errors.NO_ERROR)
# Idiomatic interface.
-with pyme.Context() as c:
+with gpg.Context() as c:
alpha = c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False)
bob = c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False)
plaintext, _, verify_result = \
diff --git a/lang/python/tests/t-decrypt.py b/lang/python/tests/t-decrypt.py
index 2d85bc2b..74df3427 100755
--- a/lang/python/tests/t-decrypt.py
+++ b/lang/python/tests/t-decrypt.py
@@ -20,8 +20,8 @@
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
+from gpg import core, constants
import support
support.init_gpgme(constants.PROTOCOL_OpenPGP)
@@ -38,7 +38,7 @@ assert not result.unsupported_algorithm, \
support.print_data(sink)
# Idiomatic interface.
-with pyme.Context() as c:
+with gpg.Context() as c:
plaintext, _, _ = c.decrypt(open(support.make_filename("cipher-1.asc")))
assert len(plaintext) > 0
assert plaintext.find(b'Wenn Sie dies lesen k') >= 0, \
diff --git a/lang/python/tests/t-edit.py b/lang/python/tests/t-edit.py
index 18bcb94e..a3023e43 100755
--- a/lang/python/tests/t-edit.py
+++ b/lang/python/tests/t-edit.py
@@ -23,7 +23,7 @@ del absolute_import, print_function, unicode_literals
import sys
import os
-from pyme import core, constants
+from gpg import core, constants
import support
class KeyEditor(object):
diff --git a/lang/python/tests/t-encrypt-large.py b/lang/python/tests/t-encrypt-large.py
index b9cc3b57..25373d73 100755
--- a/lang/python/tests/t-encrypt-large.py
+++ b/lang/python/tests/t-encrypt-large.py
@@ -22,7 +22,7 @@ del absolute_import, print_function, unicode_literals
import sys
import random
-from pyme import core, constants
+from gpg import core, constants
import support
if len(sys.argv) == 2:
diff --git a/lang/python/tests/t-encrypt-sign.py b/lang/python/tests/t-encrypt-sign.py
index a453f796..a1197e51 100755
--- a/lang/python/tests/t-encrypt-sign.py
+++ b/lang/python/tests/t-encrypt-sign.py
@@ -21,8 +21,8 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import sys
-import pyme
-from pyme import core, constants
+import gpg
+from gpg import core, constants
import support
support.init_gpgme(constants.PROTOCOL_OpenPGP)
@@ -76,7 +76,7 @@ for recipients in (keys, []):
# Idiomatic interface.
-with pyme.Context(armor=True) as c:
+with gpg.Context(armor=True) as c:
message = "Hallo Leute\n".encode()
ciphertext, _, sig_result = c.encrypt(message,
recipients=keys,
@@ -91,7 +91,7 @@ with pyme.Context(armor=True) as c:
c.signers = [c.get_key(support.encrypt_only, True)]
try:
c.encrypt(message, recipients=keys, always_trust=True)
- except pyme.errors.InvalidSigners as e:
+ except gpg.errors.InvalidSigners as e:
assert len(e.signers) == 1
assert support.encrypt_only.endswith(e.signers[0].fpr)
else:
diff --git a/lang/python/tests/t-encrypt-sym.py b/lang/python/tests/t-encrypt-sym.py
index d5771845..588e7a51 100755
--- a/lang/python/tests/t-encrypt-sym.py
+++ b/lang/python/tests/t-encrypt-sym.py
@@ -21,8 +21,8 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import os
-import pyme
-from pyme import core, constants
+import gpg
+from gpg import core, constants
import support
support.init_gpgme(constants.PROTOCOL_OpenPGP)
@@ -68,7 +68,7 @@ for passphrase in ("abc", b"abc"):
# Idiomatic interface.
for passphrase in ("abc", b"abc"):
- with pyme.Context(armor=True) as c:
+ with gpg.Context(armor=True) as c:
# Check that the passphrase callback is not altered.
def f(*args):
assert False
diff --git a/lang/python/tests/t-encrypt.py b/lang/python/tests/t-encrypt.py
index 65e7d248..9ea2ce14 100755
--- a/lang/python/tests/t-encrypt.py
+++ b/lang/python/tests/t-encrypt.py
@@ -20,8 +20,8 @@
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
+from gpg import core, constants
import support
support.init_gpgme(constants.PROTOCOL_OpenPGP)
@@ -42,7 +42,7 @@ assert not result.invalid_recipients, \
support.print_data(sink)
# Idiomatic interface.
-with pyme.Context(armor=True) as c:
+with gpg.Context(armor=True) as c:
ciphertext, _, _ = c.encrypt("Hallo Leute\n".encode(),
recipients=keys,
sign=False,
@@ -58,7 +58,7 @@ with pyme.Context(armor=True) as c:
c.encrypt("Hallo Leute\n".encode(),
recipients=[c.get_key(support.sign_only, False)],
sign=False, always_trust=True)
- except pyme.errors.InvalidRecipients as e:
+ except gpg.errors.InvalidRecipients as e:
assert len(e.recipients) == 1
assert support.sign_only.endswith(e.recipients[0].fpr)
else:
diff --git a/lang/python/tests/t-export.py b/lang/python/tests/t-export.py
index db36b989..d96e04d8 100755
--- a/lang/python/tests/t-export.py
+++ b/lang/python/tests/t-export.py
@@ -20,7 +20,7 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import core, constants
+from gpg import core, constants
import support
support.init_gpgme(constants.PROTOCOL_OpenPGP)
diff --git a/lang/python/tests/t-file-name.py b/lang/python/tests/t-file-name.py
index e93b1200..6038fb5c 100755
--- a/lang/python/tests/t-file-name.py
+++ b/lang/python/tests/t-file-name.py
@@ -21,7 +21,7 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import os
-from pyme import core, constants
+from gpg import core, constants
import support
testname = "abcde12345"
diff --git a/lang/python/tests/t-idiomatic.py b/lang/python/tests/t-idiomatic.py
index f0632064..4df8742c 100755
--- a/lang/python/tests/t-idiomatic.py
+++ b/lang/python/tests/t-idiomatic.py
@@ -24,13 +24,13 @@ import sys
import io
import os
import tempfile
-import pyme
+import gpg
import support
-support.init_gpgme(pyme.constants.PROTOCOL_OpenPGP)
+support.init_gpgme(gpg.constants.PROTOCOL_OpenPGP)
# Both Context and Data can be used as context manager:
-with pyme.Context() as c, pyme.Data() as d:
+with gpg.Context() as c, gpg.Data() as d:
c.get_engine_info()
d.write(b"Halloechen")
leak_c = c
@@ -39,17 +39,17 @@ assert leak_c.wrapped == None
assert leak_d.wrapped == None
def sign_and_verify(source, signed, sink):
- with pyme.Context() as c:
- c.op_sign(source, signed, pyme.constants.SIG_MODE_NORMAL)
+ with gpg.Context() as c:
+ c.op_sign(source, signed, gpg.constants.SIG_MODE_NORMAL)
signed.seek(0, os.SEEK_SET)
c.op_verify(signed, None, sink)
result = c.op_verify_result()
assert len(result.signatures) == 1, "Unexpected number of signatures"
sig = result.signatures[0]
- assert sig.summary == (pyme.constants.SIGSUM_VALID |
- pyme.constants.SIGSUM_GREEN)
- assert pyme.errors.GPGMEError(sig.status).getcode() == pyme.errors.NO_ERROR
+ assert sig.summary == (gpg.constants.SIGSUM_VALID |
+ gpg.constants.SIGSUM_GREEN)
+ assert gpg.errors.GPGMEError(sig.status).getcode() == gpg.errors.NO_ERROR
sink.seek(0, os.SEEK_SET)
assert sink.read() == b"Hallo Leute\n"
@@ -80,5 +80,5 @@ if sys.version_info[0] == 3:
# Demonstrate automatic wrapping of objects implementing the buffer
# interface, and the use of data objects with the 'with' statement.
- with io.BytesIO(preallocate) as signed, pyme.Data() as sink:
+ with io.BytesIO(preallocate) as signed, gpg.Data() as sink:
sign_and_verify(b"Hallo Leute\n", signed, sink)
diff --git a/lang/python/tests/t-import.py b/lang/python/tests/t-import.py
index 0b50d027..1d15b96b 100755
--- a/lang/python/tests/t-import.py
+++ b/lang/python/tests/t-import.py
@@ -20,7 +20,7 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import core, constants
+from gpg import core, constants
import support
def check_result(result, fpr, secret):
diff --git a/lang/python/tests/t-keylist.py b/lang/python/tests/t-keylist.py
index f7f6674e..8dd12ae6 100755
--- a/lang/python/tests/t-keylist.py
+++ b/lang/python/tests/t-keylist.py
@@ -20,8 +20,8 @@
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
+from gpg import core, constants
import support
support.init_gpgme(constants.PROTOCOL_OpenPGP)
@@ -248,7 +248,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 +263,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"
diff --git a/lang/python/tests/t-protocol-assuan.py b/lang/python/tests/t-protocol-assuan.py
index 172c7d0c..ad22ae3f 100755
--- a/lang/python/tests/t-protocol-assuan.py
+++ b/lang/python/tests/t-protocol-assuan.py
@@ -20,17 +20,17 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
+import gpg
-with pyme.Context(protocol=pyme.constants.PROTOCOL_ASSUAN) as c:
+with gpg.Context(protocol=gpg.constants.PROTOCOL_ASSUAN) as c:
# Do nothing.
c.assuan_transact('nop')
c.assuan_transact('NOP')
c.assuan_transact(['NOP'])
err = c.assuan_transact('idontexist')
- assert err.getsource() == pyme.errors.SOURCE_GPGAGENT
- assert err.getcode() == pyme.errors.ASS_UNKNOWN_CMD
+ assert err.getsource() == gpg.errors.SOURCE_GPGAGENT
+ assert err.getcode() == gpg.errors.ASS_UNKNOWN_CMD
# Invoke the pinentry to get a confirmation.
c.assuan_transact(['GET_CONFIRMATION', 'Hello there'])
diff --git a/lang/python/tests/t-sig-notation.py b/lang/python/tests/t-sig-notation.py
index eb5b111c..a30a7f45 100755
--- a/lang/python/tests/t-sig-notation.py
+++ b/lang/python/tests/t-sig-notation.py
@@ -21,7 +21,7 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import os
-from pyme import core, constants
+from gpg import core, constants
import support
expected_notations = {
diff --git a/lang/python/tests/t-sign.py b/lang/python/tests/t-sign.py
index b0e211a1..f07f6efd 100755
--- a/lang/python/tests/t-sign.py
+++ b/lang/python/tests/t-sign.py
@@ -21,8 +21,8 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import os
-import pyme
-from pyme import core, constants
+import gpg
+from gpg import core, constants
import support
def fail(msg):
@@ -90,23 +90,23 @@ check_result(result, constants.SIG_MODE_CLEAR)
support.print_data(sink)
# Idiomatic interface.
-with pyme.Context(armor=True, textmode=True) as c:
+with gpg.Context(armor=True, textmode=True) as c:
message = "Hallo Leute\n".encode()
signed, _ = c.sign(message)
assert len(signed) > 0
assert signed.find(b'BEGIN PGP MESSAGE') > 0, 'Message not found'
- signed, _ = c.sign(message, mode=pyme.constants.SIG_MODE_DETACH)
+ signed, _ = c.sign(message, mode=gpg.constants.SIG_MODE_DETACH)
assert len(signed) > 0
assert signed.find(b'BEGIN PGP SIGNATURE') > 0, 'Signature not found'
- signed, _ = c.sign(message, mode=pyme.constants.SIG_MODE_CLEAR)
+ signed, _ = c.sign(message, mode=gpg.constants.SIG_MODE_CLEAR)
assert len(signed) > 0
assert signed.find(b'BEGIN PGP SIGNED MESSAGE') > 0, 'Message not found'
assert signed.find(message) > 0, 'Message content not found'
assert signed.find(b'BEGIN PGP SIGNATURE') > 0, 'Signature not found'
-with pyme.Context() as c:
+with gpg.Context() as c:
message = "Hallo Leute\n".encode()
c.signers = [c.get_key(support.sign_only, True)]
@@ -115,7 +115,7 @@ with pyme.Context() as c:
c.signers = [c.get_key(support.encrypt_only, True)]
try:
c.sign(message)
- except pyme.errors.InvalidSigners as e:
+ except gpg.errors.InvalidSigners as e:
assert len(e.signers) == 1
assert support.encrypt_only.endswith(e.signers[0].fpr)
else:
diff --git a/lang/python/tests/t-signers.py b/lang/python/tests/t-signers.py
index 11403aff..6afe8f64 100755
--- a/lang/python/tests/t-signers.py
+++ b/lang/python/tests/t-signers.py
@@ -20,8 +20,8 @@
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
+from gpg import core, constants
import support
def fail(msg):
@@ -81,7 +81,7 @@ for mode in (constants.SIG_MODE_NORMAL, constants.SIG_MODE_DETACH,
support.print_data(sink)
# Idiomatic interface.
-with pyme.Context(armor=True, textmode=True, signers=keys) as c:
+with gpg.Context(armor=True, textmode=True, signers=keys) as c:
message = "Hallo Leute\n".encode()
signed, result = c.sign(message)
check_result(result, constants.SIG_MODE_NORMAL)
diff --git a/lang/python/tests/t-trustlist.py b/lang/python/tests/t-trustlist.py
index 4253bd7e..43424c3c 100755
--- a/lang/python/tests/t-trustlist.py
+++ b/lang/python/tests/t-trustlist.py
@@ -20,7 +20,7 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import core, constants
+from gpg import core, constants
import support
support.init_gpgme(constants.PROTOCOL_OpenPGP)
diff --git a/lang/python/tests/t-verify.py b/lang/python/tests/t-verify.py
index 39f6176d..830c1788 100755
--- a/lang/python/tests/t-verify.py
+++ b/lang/python/tests/t-verify.py
@@ -22,8 +22,8 @@ del absolute_import, print_function, unicode_literals
import sys
import os
-import pyme
-from pyme import core, constants, errors
+import gpg
+from gpg import core, constants, errors
import support
test_text1 = b"Just GNU it!\n"
@@ -145,7 +145,7 @@ else:
# Idiomatic interface.
-with pyme.Context(armor=True) as c:
+with gpg.Context(armor=True) as c:
# Checking a valid message.
_, result = c.verify(test_text1, test_sig1)
check_result(result, constants.SIGSUM_VALID | constants.SIGSUM_GREEN,
diff --git a/lang/python/tests/t-wait.py b/lang/python/tests/t-wait.py
index b7d9a34b..96461f3e 100755
--- a/lang/python/tests/t-wait.py
+++ b/lang/python/tests/t-wait.py
@@ -21,7 +21,7 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import time
-from pyme import core, constants, errors
+from gpg import core, constants, errors
import support
support.init_gpgme(constants.PROTOCOL_OpenPGP)
diff --git a/lang/python/tests/t-wrapper.py b/lang/python/tests/t-wrapper.py
index d260264f..3ffd3e80 100755
--- a/lang/python/tests/t-wrapper.py
+++ b/lang/python/tests/t-wrapper.py
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see <http://www.gnu.org/licenses/>.
-from pyme import core
+from gpg import core
d0 = core.Data()
d0.seek # trigger on-demand-wrapping