summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-08-07 13:40:29 -0700
committerDylan Baker <dylan@pnwbakers.com>2017-08-14 09:29:28 -0700
commitc377ee5bd6e2b64be8bbdd5df72ac3ca50373134 (patch)
treeff377ff7436e50e631764d0141d98161e7248218
parentec504a44af0420669c0ce28f35679835e3f9e32c (diff)
tests/crypto: Fix GetKey.test_missing_key
'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.
-rw-r--r--tests/crypto_test.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/crypto_test.py b/tests/crypto_test.py
index d0877bea..e51adaeb 100644
--- a/tests/crypto_test.py
+++ b/tests/crypto_test.py
@@ -266,6 +266,11 @@ class TestGetKey(unittest.TestCase):
def test_missing_key(self):
with self.assertRaises(GPGProblem) as caught:
+ crypto.get_key('foo@example.com')
+ self.assertEqual(caught.exception.code, GPGCode.NOT_FOUND)
+
+ def test_invalid_key(self):
+ with self.assertRaises(GPGProblem) as caught:
crypto.get_key('z')
self.assertEqual(caught.exception.code, GPGCode.NOT_FOUND)