aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/tests (follow)
Commit message (Collapse)AuthorAgeFilesLines
* python: Add a nicer interface to list keys.Justus Winter2016-08-031-1/+1
| | | | | | | * lang/python/pyme/core.py (Context.keylist): New method. * lang/python/tests/t-keylist.py: Test new method. Signed-off-by: Justus Winter <[email protected]>
* python: Drop superfluous imports and trim public interface.Justus Winter2016-07-284-5/+1
| | | | | | | | | | | | | | | * lang/python/pyme/__init__.py: Avoid leaking low-level 'gpgme', make sure the main module looks nice and tidy, appease pyflakes. * lang/python/pyme/errors.py: Appease pyflakes. * lang/python/pyme/util.py: Avoid leaking low-level 'gpgme' into the module namespace. * lang/python/pyme/version.py.in: Likewise. * lang/python/tests/t-keylist.py: Drop superfluous imports. * lang/python/tests/t-sig-notation.py: Likewise. * lang/python/tests/t-sign.py: Likewise. * lang/python/tests/t-signers.py: Likewise. Signed-off-by: Justus Winter <[email protected]>
* python: Support the Assuan engine.Justus Winter2016-07-282-1/+68
| | | | | | | | | | | | | | * lang/python/gpgme.i: Add typemaps for the Assuan protocol callbacks. * lang/python/helpers.c (_pyme_assuan_{data,inquire,status}_cb): New functions. * lang/python/private.h (_pyme_assuan_{data,inquire,status}_cb): New prototypes. * lang/python/pyme/core.py (Context.assuan_transact): New method. * lang/python/pyme/util.py (percent_escape): New function. * lang/python/tests/Makefile.am (py_tests): Add new test. * lang/python/tests/t-protocol-assuan.py: New file. Signed-off-by: Justus Winter <[email protected]>
* python: Add an idiomatic interface.Justus Winter2016-07-1515-44/+385
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac: Bump required Python version. * lang/python/pyme/__init__.py: Update docstring. Import Context and Data. * lang/python/pyme/core.py (Context.encrypt): New function. (Context.decrypt): Likewise. (Context.sign): Likewise. (Context.verify): Likewise. * lang/python/pyme/errors.py: Add new errors. * lang/python/pyme/util.py (process_constants): Rework and return the inserted keys. * lang/python/tests/Makefile.am (EXTRA_DIST): Add new keys. * lang/python/tests/encrypt-only.asc: New file. * lang/python/tests/sign-only.asc: Likewise. * lang/python/tests/initial.py: Mark key 'Alpha' as trusted, import new keys. * lang/python/tests/support.py: Add fingerprints of known keys. (in_srcdir): New function. (print_data): Handle bytes too. (mark_key_trusted): New function. * lang/python/tests/t-decrypt-verify.py: Adjust test. Test idiomatic interface. * lang/python/tests/t-decrypt.py: Test idiomatic interface. * 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-idiomatic.py: Simplify. * lang/python/tests/t-keylist.py: Adjust to newly trusted key. * lang/python/tests/t-sign.py: Likewise. Test idiomatic interface. * lang/python/tests/t-signers.py: Likewise. * lang/python/tests/t-verify.py: Likewise. Signed-off-by: Justus Winter <[email protected]>
* python: Fix test.Justus Winter2016-07-141-13/+5
| | | | | | | * lang/python/tests/t-keylist.py: Do not assume key alpha is trusted yet. Signed-off-by: Justus Winter <[email protected]>
* python: Port more tests.Justus Winter2016-07-124-4/+331
| | | | | | | | | | | | | * lang/python/pyme/core.py (Context.op_keylist_all): Add missing 'op_keylist_end'. (Context.op_trustlist_all): Fix function. Add missing 'op_trustlist_end'. * lang/python/tests/Makefile.am (pytests): Add new files. * lang/python/tests/t-import.py: New file. * lang/python/tests/t-keylist.py: Likewise. * lang/python/tests/t-trustlist.py: Check alternate interface. Signed-off-by: Justus Winter <[email protected]>
* python: Fix distcheck.Justus Winter2016-07-073-4/+51
| | | | | | | | | | | | | | * lang/python/INSTALL: Drop obsolete file. * lang/python/Makefile.am (EXTRA_DIST): Add missing files. (CLEANFILES): Remove generated files. (clean-local): Fix permissions of copied files. * lang/python/tests/Makefile.am (TESTS): Use our own setup and teardown scripts. (EXTRA_DIST): Add missing files. * lang/python/tests/final.py: New file. * lang/python/tests/initial.py: Likewise. Signed-off-by: Justus Winter <[email protected]>
* python: Wrap objects implementing the buffer protocol.Justus Winter2016-06-161-8/+27
| | | | | | | | | | | | | | | | | * lang/python/Makefile.am: Add the toplevel source directory to CFLAGS when compiling the bindings so that we can use private header files. * lang/python/gpgme.i (gpgme_data_t): Rework the object wrapping. Do not create a Python wrapper object, merely a gpgme_data_t object, and keep references to buffer objects, if any. If necessary, update the buffer after the function call. (pygpgme_wrap_gpgme_data_t): New function. * lang/python/helpers.c (object_to_gpgme_data_t): Rework object wrapping. Also wrap objects implementing the buffer protocol. * lang/python/helpers.h (object_to_gpgme_data_t): Update prototype. (pygpgme_wrap_gpgme_data_t): New prototype. * lang/python/tests/t-idiomatic.py: Demonstrate this. Signed-off-by: Justus Winter <[email protected]>
* python: Implement the context manager protocol.Justus Winter2016-06-081-5/+14
| | | | | | | | | | | | | * lang/python/pyme/core.py (Context.__del__): Make function idemptotent. (Context.{__enter__,__exit__}): Implement the context manager protocol. (Data.__del__): Make function idemptotent, drop debug print. (Data.{__enter__,__exit__}): Implement the context manager protocol. * lang/python/tests/t-idiomatic.py: Demonstrate this. Signed-off-by: Justus Winter <[email protected]>
* python: Wrap file-like objects on demand.Justus Winter2016-06-062-1/+49
| | | | | | | | | | | | * lang/python/gpgme.i (gpgme_data_t): Use new function to create wrapper objects if necessary, and deallocate them after the function call. * lang/python/helpers.c (object_to_gpgme_data_t): New function. * lang/python/helpers.h (object_to_gpgme_data_t): New prototype. * lang/python/tests/Makefile.am (pytests): Add new test. * lang/python/tests/t-idiomatic.py: New file. Signed-off-by: Justus Winter <[email protected]>
* python: Initialize GPGME for the user.Justus Winter2016-06-061-1/+0
| | | | | | | * lang/python/pyme/core.py: Call 'check_version' and explain why. * lang/python/tests/support.py (init_gpgme): Drop call here. Signed-off-by: Justus Winter <[email protected]>
* python: Fix test suite with GnuPG prior to 2.1.12.Justus Winter2016-06-011-1/+2
| | | | | | | * lang/python/tests/Makefile.am (gpg-agent.conf): Use 'allow-loopback-pinentry'. Signed-off-by: Justus Winter <[email protected]>
* tests: Fix notation tests.Justus Winter2016-06-011-3/+2
| | | | | | | | | * lang/python/tests/t-sig-notation.py (check_result): Check critical flag. * tests/gpg/t-sig-notation.c (check_result): Likewise. Fixes-commit: 1cacd7d0 Signed-off-by: Justus Winter <[email protected]>
* python: Port more tests.Justus Winter2016-05-314-0/+249
| | | | | | | | | | * lang/python/gpgme.i: Hide length fields of notations. * lang/python/tests/Makefile.am (pytests): Add new tests. * lang/python/tests/t-decrypt-verify.py: New file. * lang/python/tests/t-sig-notation.py: Likewise. * lang/python/tests/t-verify.py: Likewise. Signed-off-by: Justus Winter <[email protected]>
* python: Port more tests.Justus Winter2016-05-276-2/+149
| | | | | | | | | | | | | | * lang/python/pyme/core.py (Data._error_check): Add 'gpgme_data_get_file_name' to the list of functions not returning an error code. * lang/python/tests/Makefile.am (pytests): Add new tests. * lang/python/tests/support.py (verbose): New variable. * lang/python/tests/t-data.py: Test setting and getting the filename. * lang/python/tests/t-encrypt-large.py: New file. * lang/python/tests/t-file-name.py: Likewise. * lang/python/tests/t-trustlist.py: Likewise. Signed-off-by: Justus Winter <[email protected]>
* python: Implement data callbacks.Justus Winter2016-05-272-0/+112
| | | | | | | | | | | | | | | | | | | | | | * lang/python/gpgme.i (object_to_gpgme_t): Set exception on error. * lang/python/helpers.c (pyDataReadCb): New function. (pyDataWriteCb): Likewise. (pyDataSeekCb): Likewise. (pyDataReleaseCb): Likewise. (pygpgme_data_new_from_cbs): Likewise. * lang/python/helpers.h (pygpgme_data_new_from_cbs): New prototype. * lang/python/pyme/core.py (Data.__init__): Fix docstring, fix read callbacks. (Data.__del__): Fix read callbacks. (Data._free_readcb): Drop function. (Data._free_datacbs): New function. (Data.new_from_cbs): Fix setting the callbacks. (Data.write): Raise stashed exceptions. (Data.read): Likewise. * lang/python/tests/t-callbacks.py: Test new functionality. * lang/python/tests/t-data.py: Likewise. Signed-off-by: Justus Winter <[email protected]>
* python: Fix reading data from existing files.Justus Winter2016-05-271-1/+33
| | | | | | | | | | | | | * lang/python/pyme/core.py (Data.__init__): Add 'copy' kwargument, and pass it to functions supporting it. PEP8 fix. (Data.new_from_fd): PEP8 fix. (Data.new_from_file): Give a more helpful error message if copy is False. PEP8 fix. (Data.new_from_fd): Hand the file descriptor to 'gpgme_data_new_from_fd', not a stream. Fix docstring. * lang/python/tests/t-data.py: Add tests for this. Signed-off-by: Justus Winter <[email protected]>
* python: Improve and test Context.wait.Justus Winter2016-05-242-1/+44
| | | | | | | | | | * lang/python/pyme/core.py (Context.wait): Improve docstring. As the context passed to 'gpgme_wait' is never NULL, it is pointless to look at the returned context. Always raise exceptions. * lang/python/tests/Makefile.am (pytests): Add new test. * lang/python/tests/t-wait.py: New file. Signed-off-by: Justus Winter <[email protected]>
* python: Support status callbacks.Justus Winter2016-05-241-0/+35
| | | | | | | | | | | | | * lang/python/helpers.c (pyStatusCb): New function. (pygpgme_set_status_cb): Likewise. * lang/python/helpers.h (pygpgme_set_status_cb): New prototype. * lang/python/pyme/core.py (Context.__init__): Initialize 'last_statuscb'. (Context._free_statuscb): New function. (Context.set_status_cb): Likewise. * lang/python/tests/t-callbacks.py: Test status callbacks. Signed-off-by: Justus Winter <[email protected]>
* python: Improve support for edit callbacks.Justus Winter2016-05-243-1/+97
| | | | | | | | | | * lang/python/helpers.c (pyEditCb): Stash exceptions. * lang/python/pyme/core.py (Context.op_edit): Hand in 'self'. * lang/python/tests/Makefile.am (py_tests): Add new test. * lang/python/tests/t-callbacks.py: Test edit callbacks. * lang/python/tests/t-edit.py: New file. Signed-off-by: Justus Winter <[email protected]>
* python: Fix hook.Justus Winter2016-05-231-1/+2
| | | | | | | * lang/python/helpers.c (pyProgressCb): Fix getting hook data. * lang/python/tests/t-callbacks.py: Show that this works. Signed-off-by: Justus Winter <[email protected]>
* python: Port more tests.Justus Winter2016-05-235-2/+188
| | | | | | | | | | | | * lang/python/tests/Makefile.am (TESTS_ENVIRONMENT): Set LD_LIBRARY_PATH. (pytests): Add new tests. * lang/python/tests/t-callbacks.py: Trim imports. * lang/python/tests/t-encrypt-sign.py: New file. * lang/python/tests/t-export.py: Likewise. * lang/python/tests/t-signers.py: Likewise. Signed-off-by: Justus Winter <[email protected]>
* python: Improve progress callbacks.Justus Winter2016-05-191-0/+38
| | | | | | | | | * lang/python/helpers.c (pyProgressCb): Stash python errors, convert 'what' to Unicode object. * lang/python/pyme/core.py (Context.set_progress_cb): Hand in 'self'. * lang/python/tests/t-callbacks.py: Test progress callbacks. Signed-off-by: Justus Winter <[email protected]>
* python: Robust exception handling in callbacks.Justus Winter2016-05-192-0/+78
| | | | | | | | | | | | | | | | | | * lang/python/helpers.c (pygpgme_stash_callback_exception): New function. (pygpgme_raise_callback_exception): Likewise. (pyPassphraseCb): Stash python errors. * lang/python/helpers.h (pygpgme_raise_callback_exception): New prototype. * lang/python/pyme/core.py ({Context,Data}.__init__): Move common initialization to superclass. (Context.set_progress_cb): Hand in 'self'. * lang/python/pyme/util.py (GpgmeWrapper.__init__): New function. (GpgmeWrapper.__getattr__): Raise stashed exceptions. * lang/python/tests/Makefile.am (py_tests): Add new test. * lang/python/tests/t-callbacks.py: New file. Signed-off-by: Justus Winter <[email protected]>
* python: Add more tests.Justus Winter2016-05-196-8/+157
| | | | | | | | | | | * lang/python/tests/Makefile.am (py_tests): Add new tests. * lang/python/tests/support.py (print_data): New function. * lang/python/tests/t-decrypt.py: Use new function. * lang/python/tests/t-encrypt.py: Likewise. * lang/python/tests/t-sign.py: New file. * lang/python/tests/t-encrypt-sym.py: Likewise. Signed-off-by: Justus Winter <[email protected]>
* python: Port more tests.Justus Winter2016-05-174-1/+166
| | | | | | | | | * lang/python/Makefile.am: Add bits from the c test suite. * lang/python/support.py: New file. * lang/python/t-decrypt.py: Likewise. * lang/python/t-encrypt.py: Likewise. Signed-off-by: Justus Winter <[email protected]>
* python: Share generated methods between objects.justus/pyme3Justus Winter2016-05-121-0/+2
| | | | | | | | * lang/python/pyme/util.py (GpgmeWrapper.__getattr__): Monkey-patch the class. * lang/python/tests/t-wrapper.py: Demonstrate the sharing. Signed-off-by: Justus Winter <[email protected]>
* python: Fix writing to data buffers.Justus Winter2016-05-122-1/+50
| | | | | | | | | * lang/python/gpgme.i: Add typemap for buffers. * lang/python/pyme/core.py (Data.write): Fix function. * lang/python/tests/Makefile.am: Add new test. * lang/python/tests/t-data.py: New file. Signed-off-by: Justus Winter <[email protected]>
* python: Add a test suite.Justus Winter2016-05-122-0/+45
* configure.ac: Add new Makefile. * lang/python/Makefile.am: Add subdirectory. * lang/python/tests/Makefile.am: New file. * lang/python/tests/t-wrapper.py: Likewise. Signed-off-by: Justus Winter <[email protected]>