Commit | Line | Data |
---|---|---|
1c9cea74 LF |
1 | Fix test failure of test_XXX caused by upgrade of gpgme from 1.6.0 to |
2 | 1.8.0: | |
3 | ||
4 | ====================================================================== | |
5 | FAIL: test_encrypt_to_signonly (tests.test_encrypt_decrypt.EncryptDecryptTestCase) | |
6 | ---------------------------------------------------------------------- | |
7 | Traceback (most recent call last): | |
8 | File "/tmp/guix-build-python2-pygpgme-0.3.drv-0/pygpgme-0.3/tests/test_encrypt_decrypt.py", line 185, in test_encrypt_to_signonly | |
9 | self.assertEqual(exc.args[0], gpgme.ERR_SOURCE_UNKNOWN) | |
10 | AssertionError: 7 != 0 | |
11 | ||
12 | ---------------------------------------------------------------------- | |
13 | ||
14 | Patch copied from the Debian package pygpgme-0.3-1.2: | |
15 | ||
16 | https://sources.debian.net/src/pygpgme/0.3-1.2/debian/patches/0005-Fix-test-failures-with-pinentry.patch/ | |
17 | ||
18 | From: "Dr. Tobias Quathamer" <toddy@debian.org> | |
19 | Date: Thu, 24 Nov 2016 12:20:54 +0100 | |
20 | Subject: Fix test failures with pinentry | |
21 | ||
22 | --- | |
23 | tests/test_encrypt_decrypt.py | 5 +++-- | |
24 | tests/test_passphrase.py | 2 ++ | |
25 | 2 files changed, 5 insertions(+), 2 deletions(-) | |
26 | ||
27 | diff --git a/tests/test_encrypt_decrypt.py b/tests/test_encrypt_decrypt.py | |
28 | index 21ae83e..05707e1 100644 | |
29 | --- a/tests/test_encrypt_decrypt.py | |
30 | +++ b/tests/test_encrypt_decrypt.py | |
31 | @@ -132,6 +132,7 @@ class EncryptDecryptTestCase(GpgHomeTestCase): | |
32 | os.write(fd, b'Symmetric passphrase\n') | |
33 | ctx = gpgme.Context() | |
34 | ctx.armor = True | |
35 | + ctx.pinentry_mode = gpgme.PINENTRY_MODE_LOOPBACK | |
36 | ctx.passphrase_cb = passphrase | |
37 | ctx.encrypt(None, 0, plaintext, ciphertext) | |
38 | self.assertTrue( | |
39 | @@ -182,8 +183,8 @@ class EncryptDecryptTestCase(GpgHomeTestCase): | |
40 | ctx.encrypt([recipient], gpgme.ENCRYPT_ALWAYS_TRUST, | |
41 | plaintext, ciphertext) | |
42 | except gpgme.GpgmeError as exc: | |
43 | - self.assertEqual(exc.args[0], gpgme.ERR_SOURCE_UNKNOWN) | |
44 | - self.assertEqual(exc.args[1], gpgme.ERR_GENERAL) | |
45 | + self.assertEqual(exc.args[0], gpgme.ERR_SOURCE_GPGME) | |
46 | + self.assertEqual(exc.args[1], gpgme.ERR_UNUSABLE_PUBKEY) | |
47 | else: | |
48 | self.fail('gpgme.GpgmeError not raised') | |
49 | ||
50 | diff --git a/tests/test_passphrase.py b/tests/test_passphrase.py | |
51 | index 35b3c59..05e6811 100644 | |
52 | --- a/tests/test_passphrase.py | |
53 | +++ b/tests/test_passphrase.py | |
54 | @@ -34,6 +34,7 @@ class PassphraseTestCase(GpgHomeTestCase): | |
55 | ctx = gpgme.Context() | |
56 | key = ctx.get_key('EFB052B4230BBBC51914BCBB54DCBBC8DBFB9EB3') | |
57 | ctx.signers = [key] | |
58 | + ctx.pinentry_mode = gpgme.PINENTRY_MODE_LOOPBACK | |
59 | plaintext = BytesIO(b'Hello World\n') | |
60 | signature = BytesIO() | |
61 | ||
62 | @@ -55,6 +56,7 @@ class PassphraseTestCase(GpgHomeTestCase): | |
63 | ctx = gpgme.Context() | |
64 | key = ctx.get_key('EFB052B4230BBBC51914BCBB54DCBBC8DBFB9EB3') | |
65 | ctx.signers = [key] | |
66 | + ctx.pinentry_mode = gpgme.PINENTRY_MODE_LOOPBACK | |
67 | ctx.passphrase_cb = self.passphrase_cb | |
68 | plaintext = BytesIO(b'Hello World\n') | |
69 | signature = BytesIO() |