From fa727dcf0058058565278421d16ea75c156e7fa3 Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt Date: Wed, 3 Sep 2014 00:12:13 +0200 Subject: [PATCH] test_gpg.py: also check signature timestamp --- tests/test_gpg.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_gpg.py b/tests/test_gpg.py index 8f752f66..445eb460 100755 --- a/tests/test_gpg.py +++ b/tests/test_gpg.py @@ -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() -- 2.39.5