aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/tests
diff options
context:
space:
mode:
authorTobias Mueller <[email protected]>2016-12-03 22:12:37 +0000
committerJustus Winter <[email protected]>2017-01-25 16:47:35 +0000
commit9291ebaa4151a1f6c8c0601095ec45809b963383 (patch)
tree8f064afc68f27aa452f7d9679fa90146241ef9bb /lang/python/tests
parenttests: Use --debug-quick-random for tests (diff)
downloadgpgme-9291ebaa4151a1f6c8c0601095ec45809b963383.tar.gz
gpgme-9291ebaa4151a1f6c8c0601095ec45809b963383.zip
python: default op_keylist_start parameters.
* lang/python/gpgme.i: Added gpgme_op_keylist_start with defaults * lang/python/tests/t-keylist.py: Added tests for default parameters -- To increase the ease of use, op_keylist_start parameters default to sensible values. The empty string matches all keys. We assume that the user wants to retrieve public keys most of the time, so we default to public keys rather than secret keys. Signed-off-by: Tobias Mueller <[email protected]>
Diffstat (limited to 'lang/python/tests')
-rwxr-xr-xlang/python/tests/t-keylist.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/lang/python/tests/t-keylist.py b/lang/python/tests/t-keylist.py
index ea2a7240..5077ca69 100755
--- a/lang/python/tests/t-keylist.py
+++ b/lang/python/tests/t-keylist.py
@@ -219,6 +219,18 @@ result = c.op_keylist_result()
assert not result.truncated, "Key listing unexpectedly truncated"
+# We test for a parameter-less keylist
+keyring_length = len(list(c.op_keylist_all()))
+assert keyring_length > 1,\
+ "Expected to find some keys, but got %r" % keyring_length
+
+# Then we do want to call with a pattern, only
+# i.e. without giving secret=0
+alpha_keys = list(c.op_keylist_all(b"Alpha"))
+assert len(alpha_keys) == 1, "Expected only one key for 'Alpha', got %r" % len(alpha_keys)
+
+
+
for i, key in enumerate(c.keylist()):
try:
if len(keys[i]) == 4: