summaryrefslogtreecommitdiff
path: root/tests/crypto_test.py
Commit message (Collapse)AuthorAge
* Rename test filesLucas Hoffmann2019-01-29
| | | | | | | | The two main reasons are - to run `python3 -m unittest discover` without specifying a custom `--pattern *_test.py` - to include the test files automatically when generating the MANIFEST file.
* tests: use "gpg2" instead of "gpg" commandDylan Baker2018-08-01
| | | | | | | | | Some distro (notably debian and derived distros like ubuntu) still package the obsolete gpg 1.x series as "gpg", and provide the modern gpg 2.x tool as "gpg2". Other distros don't package gpg 1.x anymore, but most seem to provide a gpg2 symlink, so this should be safe for them. This is verified working on Archlinux, and is required to make these two tests work on Ubuntu 16.04 Xenial.
* Remove old __future__ importsLucas Hoffmann2018-06-19
| | | | They are not needed for python >= 3.0.
* Wrap long statements on open-bracket syntax.Ben Finney2018-04-23
|
* Use urwid.util.detected_encoding instead of try_decodeDylan Baker2018-03-06
| | | | | Commands running in a subprocess should return the terminal encoding so we don't need to guess their encoding.
* crypto: use bytes instead of strDylan Baker2018-03-01
| | | | | | | | The crypto code shouldn't use unicode strings, it should use byte strings. The problem with using unicode strings (and doing the conversion internally), is that the crypto code doesn't know what the encoding should be. We can guess but it's better to just do bytes in bytes out, and let the calling code deal with encoding and decoding.
* Fix cryptoDylan Baker2018-03-01
| | | | | | This makes me a little nervous. I wonder if we're better off leaving the bits that gpg works with as bytes while gpg is working with them and do the string transformation later.
* alot/crypto: make keys required for detached_signature_forDylan Baker2017-08-17
| | | | | | This function is always passed a key to sign with, and not passing one leads to the first available signing key in the keyring being selected otherwise, which is problematic if one has two signing keys.
* tests/crypto: Add note about missing testsDylan Baker2017-08-14
|
* convert from pygpgme to the python "gpg" moduleDaniel Kahn Gillmor2017-08-14
| | | | | | | | | | | | | | | This converts from the now abandoned pygpgme project for wrapping gpgme, to the upstream gpgme python bindings (which are descended from the pyme project, before they became official). Largely this change should not be user visible, but there are a couple cases where the new bindings provide slightly more detailed error messages, and alot directly presents those messages to users. This patch has been significantly revised and updated by Dylan Baker, but was originally authored by Daniel Kahn Gillmor. Fixes #1069
* tests/crypto: Fix GetKey.test_missing_keyDylan Baker2017-08-14
| | | | | | | | | | | 'z', the value currently passed to get_key isn't a valid value, so it raises GPGMEError with a code of INV_VALUE. However, if an actual email is passed a KeyNotFound exception is raised instead. The existing test is valid and should remain, since it catches a potential bug, but it doesn't test for a missing key, it tests for an invalid key. This patch renames the existing test and adds a new test to cover an actual missing key.
* tests/crypto: Add more tests for list_keysDylan Baker2017-08-14
| | | | | This adds two new tests for the list_keys function that assert that the private flag is honored.
* tests: move shared helpers out of crypto module into common moduleDylan Baker2017-07-24
|
* tests/crypto: Add tests for the crypto moduleDylan Baker2017-07-15
| | | | | | This covers mosts of the functions in the crypto module, but doesn't bother with the hash_key function, which is slated for deletion in the port to python-gpg. It also doesn't cover re-raising errors.
* crypto: Fix error handling of signed messagesDylan Baker2017-07-11
| | | | | | | | | | gpgme.Context.verify doesn't raise an exception, instead it attaches the error as an attribute of the return value. This means that we've been returning that a signature is valid even when it isn't. This patch checks the attribute instead of try/excepting. Because there is a second bug (fixed in the next patch) signature verification will always fail with this patch.
* tests: Add tests for signing functions.Dylan Baker2017-07-11
| | | | | | | | This adds a couple of basic tests for the signing and verification of signatures code in the crypto module. This relies on the utilities module introduced in the last patch. One of the tests in here is expected to fail
* Add crypto tests that don't need a keyringLucas Hoffmann2017-06-21