Do not use expired key for python test
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
parent
0a90c62b78
commit
daa7419e2d
93
0001-python-bindings-callback-test.patch
Normal file
93
0001-python-bindings-callback-test.patch
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
From 651a1afe80bcc421da26f38015e8a322e140f130 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ben McGinnes <ben@adversary.org>
|
||||||
|
Date: Sat, 20 Oct 2018 11:07:55 +1100
|
||||||
|
Subject: [PATCH] python bindings: callback test
|
||||||
|
|
||||||
|
* lang/python/tests/t-callbacks.py: Updated test logic to try
|
||||||
|
generating a key which expires in 2099 and if that fails then
|
||||||
|
fallback to an expiration in 2037 in an attempt to catch the 32-bit
|
||||||
|
systems.
|
||||||
|
---
|
||||||
|
lang/python/tests/t-callbacks.py | 32 ++++++++++++++++++++++++++++++--
|
||||||
|
1 file changed, 30 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lang/python/tests/t-callbacks.py b/lang/python/tests/t-callbacks.py
|
||||||
|
index 5bcac237..3a210dd0 100755
|
||||||
|
--- a/lang/python/tests/t-callbacks.py
|
||||||
|
+++ b/lang/python/tests/t-callbacks.py
|
||||||
|
@@ -20,12 +20,14 @@
|
||||||
|
from __future__ import absolute_import, print_function, unicode_literals
|
||||||
|
|
||||||
|
import os
|
||||||
|
+import platform
|
||||||
|
import gpg
|
||||||
|
import support
|
||||||
|
_ = support # to appease pyflakes.
|
||||||
|
|
||||||
|
del absolute_import, print_function, unicode_literals
|
||||||
|
|
||||||
|
+oops = None
|
||||||
|
c = gpg.Context()
|
||||||
|
c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK)
|
||||||
|
|
||||||
|
@@ -99,6 +101,17 @@ Expire-Date: 2099-12-31
|
||||||
|
</GnupgKeyParms>
|
||||||
|
"""
|
||||||
|
|
||||||
|
+prams = """<GnupgKeyParms format="internal">
|
||||||
|
+Key-Type: RSA
|
||||||
|
+Key-Length: 1024
|
||||||
|
+Name-Real: Joe Tester
|
||||||
|
+Name-Comment: with stupid passphrase
|
||||||
|
+Name-Email: joe+gpg@example.org
|
||||||
|
+Passphrase: Crypt0R0cks
|
||||||
|
+Expire-Date: 2037-12-31
|
||||||
|
+</GnupgKeyParms>
|
||||||
|
+"""
|
||||||
|
+
|
||||||
|
messages = []
|
||||||
|
|
||||||
|
|
||||||
|
@@ -111,7 +124,10 @@ def progress_cb(what, typ, current, total, hook=None):
|
||||||
|
|
||||||
|
c = gpg.Context()
|
||||||
|
c.set_progress_cb(progress_cb, messages)
|
||||||
|
-c.op_genkey(parms, None, None)
|
||||||
|
+try:
|
||||||
|
+ c.op_genkey(parms, None, None)
|
||||||
|
+except Exception as oops:
|
||||||
|
+ c.op_genkey(prams, None, None)
|
||||||
|
assert len(messages) > 0
|
||||||
|
|
||||||
|
|
||||||
|
@@ -123,7 +139,10 @@ def progress_cb(what, typ, current, total, hook=None):
|
||||||
|
c = gpg.Context()
|
||||||
|
c.set_progress_cb(progress_cb, None)
|
||||||
|
try:
|
||||||
|
- c.op_genkey(parms, None, None)
|
||||||
|
+ try:
|
||||||
|
+ c.op_genkey(parms, None, None)
|
||||||
|
+ except Exception as oops:
|
||||||
|
+ c.op_genkey(prams, None, None)
|
||||||
|
except Exception as e:
|
||||||
|
assert e == myException
|
||||||
|
else:
|
||||||
|
@@ -139,6 +158,15 @@ alpha = c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False)
|
||||||
|
cookie = object()
|
||||||
|
edit_cb_called = False
|
||||||
|
|
||||||
|
+def oops_check():
|
||||||
|
+ if oops is not None and platform.architecture()[0] != "64bit":
|
||||||
|
+ y2k38_msg = "System appears to be 32-bit and vulnerable to EOL in 2038."
|
||||||
|
+ elif oops is not None and platform.architecture()[0] == "64bit":
|
||||||
|
+ y2k38_msg = "System appears to be 64-bit, but may use 32-bit time."
|
||||||
|
+ else:
|
||||||
|
+ y2k38_msg = "System is 64-bit and/or not susceptible to 2038 EOL."
|
||||||
|
+ return y2k38_msg
|
||||||
|
+
|
||||||
|
|
||||||
|
def edit_cb(status, args, hook):
|
||||||
|
global edit_cb_called
|
||||||
|
--
|
||||||
|
2.21.0.rc1
|
||||||
|
|
@ -20,6 +20,7 @@ Source2: gpgme-multilib.h
|
|||||||
## upstream patches
|
## upstream patches
|
||||||
# https://dev.gnupg.org/T3815
|
# https://dev.gnupg.org/T3815
|
||||||
Patch0001: 0001-qt-Use-tofu-conflict-test-keys-without-expiry.patch
|
Patch0001: 0001-qt-Use-tofu-conflict-test-keys-without-expiry.patch
|
||||||
|
Patch0002: 0001-python-bindings-callback-test.patch
|
||||||
|
|
||||||
## downstream patches
|
## downstream patches
|
||||||
# Don't add extra libs/cflags in gpgme-config/cmake equivalent
|
# Don't add extra libs/cflags in gpgme-config/cmake equivalent
|
||||||
|
Loading…
Reference in New Issue
Block a user