diff options
author | Justus Winter <[email protected]> | 2016-09-16 12:56:29 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2016-09-16 12:56:29 +0000 |
commit | a458e7fe2006d92bd5a838e2747fb66bbac4b1b8 (patch) | |
tree | 7460cc8f3ba21fec51a0a706f17747887ef37d96 /lang/python/tests/t-edit.py | |
parent | core: Fix typos. (diff) | |
download | gpgme-a458e7fe2006d92bd5a838e2747fb66bbac4b1b8.tar.gz gpgme-a458e7fe2006d92bd5a838e2747fb66bbac4b1b8.zip |
python: Adapt to 'gpgme_op_interact'.
* lang/python/examples/inter-edit.py: Update example.
* lang/python/gpgme.i (gpgme_edit_cb_t): Turn into
'gpgme_interact_cb_t'.
* lang/python/helpers.c (_pyme_edit_cb): Turn into
'_pyme_interact_cb_t'.
* lang/python/private.h (_pyme_edit_cb): Likewise.
* lang/python/pyme/constants/__init__.py: Replace numeric status codes
with the keywords.
* lang/python/pyme/constants/status.py: Likewise.
* lang/python/pyme/core.py (Context.interact): New method.
(Context.op_edit): Deprecate, update docstring, implement using
Context.interact.
* lang/python/tests/t-edit.py: Test both interfaces.
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to '')
-rwxr-xr-x | lang/python/tests/t-edit.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lang/python/tests/t-edit.py b/lang/python/tests/t-edit.py index 9ba187d5..18bcb94e 100755 --- a/lang/python/tests/t-edit.py +++ b/lang/python/tests/t-edit.py @@ -33,7 +33,7 @@ class KeyEditor(object): self.done = False self.verbose = int(os.environ.get('verbose', 0)) > 1 - def edit_fnc(self, status, args, out): + def edit_fnc(self, status, args, out=None): if args == "keyedit.prompt": result = self.steps[self.step] self.step += 1 @@ -57,8 +57,15 @@ c = core.Context() c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK) c.set_passphrase_cb(lambda *args: "abc") c.set_armor(True) -sink = core.Data() +# The deprecated interface. +editor = KeyEditor() +c.interact(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False), + editor.edit_fnc) +assert editor.done + +# The deprecated interface. +sink = core.Data() editor = KeyEditor() c.op_edit(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False), editor.edit_fnc, sink, sink) |