]> git.decadent.org.uk Git - dak.git/commitdiff
test_gpg.py: also check signature timestamp
authorAnsgar Burchardt <ansgar@debian.org>
Tue, 2 Sep 2014 22:12:13 +0000 (00:12 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Tue, 2 Sep 2014 22:12:13 +0000 (00:12 +0200)
tests/test_gpg.py

index 8f752f66d428235009768661b4545623cc1fdc41..445eb460fbb5aa5b47e8bdbf8b0b8436e76d50f8 100755 (executable)
@@ -16,6 +16,7 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
+import datetime
 import unittest
 from base_test import DakTestCase, fixture
 from daklib.gpg import GpgException, SignedFile
@@ -36,12 +37,14 @@ class GpgTest(DakTestCase):
         self.assertTrue(result.valid)
         self.assertEqual(result.primary_fingerprint, fpr_valid)
         self.assertEqual(result.contents, "Valid: yes\n")
+        self.assertEqual(result.signature_timestamp, datetime.datetime(2014, 9, 2, 21, 24, 10))
 
     def test_expired(self):
         result = verify('gpg/expired.asc', False)
         self.assertFalse(result.valid)
         self.assertEqual(result.primary_fingerprint, fpr_expired)
         self.assertEqual(result.contents, "Valid: expired\n")
+        self.assertEqual(result.signature_timestamp, datetime.datetime(2001, 2, 1, 0, 0, 0))
 
     def test_expired_assertion(self):
         with self.assertRaises(GpgException):
@@ -52,6 +55,11 @@ class GpgTest(DakTestCase):
         self.assertFalse(result.valid)
         self.assertEqual(result.primary_fingerprint, fpr_expired_subkey)
         self.assertEqual(result.contents, "Valid: expired-subkey\n")
+        self.assertEqual(result.signature_timestamp, datetime.datetime(2014, 2, 1, 0, 0, 0))
+
+    def test_expires_subkey_assertion(self):
+        with self.assertRaises(GpgException):
+            verify('gpg/expired-subkey.asc')
 
 if __name__ == '__main__':
     unittest.main()