[tor-commits] [bridgedb/develop] Add unittest for email signing with expired testing keys.

isis at torproject.org isis at torproject.org
Wed May 14 03:42:28 UTC 2014


commit 363e2ccae77d5697e1e89630f3f1f48b10fd2f39
Author: Isis Lovecruft <isis at torproject.org>
Date:   Wed Apr 23 04:22:38 2014 +0000

    Add unittest for email signing with expired testing keys.
---
 gnupghome/TESTING.subkeys.sec.EXPIRED-2013-09-11 |  Bin 0 -> 6505 bytes
 lib/bridgedb/test/test_crypto.py                 |    9 ++++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnupghome/TESTING.subkeys.sec.EXPIRED-2013-09-11 b/gnupghome/TESTING.subkeys.sec.EXPIRED-2013-09-11
new file mode 100644
index 0000000..ae13a98
Binary files /dev/null and b/gnupghome/TESTING.subkeys.sec.EXPIRED-2013-09-11 differ
diff --git a/lib/bridgedb/test/test_crypto.py b/lib/bridgedb/test/test_crypto.py
index e610d03..aca5d2c 100644
--- a/lib/bridgedb/test/test_crypto.py
+++ b/lib/bridgedb/test/test_crypto.py
@@ -171,7 +171,8 @@ class GPGContextTests(unittest.TestCase):
         topDir        = here.rstrip('_trial_temp')
         self.runDir   = os.path.join(here, 'rundir')
         self.gpgFile  = os.path.join(topDir, 'gnupghome', 'TESTING.subkeys.sec')
-        self.gpgMoved = os.path.join(here, 'TESTING.subkeys.sec')
+        self.gpgExpr  = os.path.join(topDir, 'gnupghome',
+                                     'TESTING.subkeys.sec.EXPIRED-2013-09-11')
 
         if not os.path.isdir(self.runDir):
             os.makedirs(self.runDir)
@@ -199,6 +200,12 @@ class GPGContextTests(unittest.TestCase):
         ctx = crypto.getGPGContext(self.config)
         self.assertTrue(ctx is None)
 
+    def test_getGPGContext_expired_keyfile(self):
+        """getGPGContext() with an expired key should return None."""
+        self.setKey(self.gpgExpr)
+        ctx = crypto.getGPGContext(self.config)
+        self.assertTrue(ctx is None)
+
     def test_getGPGContext_signing_disabled(self):
         """getGPGContext() with signing disabled should return None."""
         self.setKey(self.gpgFile)





More information about the tor-commits mailing list