summaryrefslogtreecommitdiff
path: root/src/leap/keymanager/tests/test_validation.py
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2014-11-10 16:18:17 -0200
committerdrebs <drebs@leap.se>2014-11-10 16:18:17 -0200
commit27776fbab6fe963082a882dfb5232c54b0195d5f (patch)
tree51780a96c6df649ce0245ce4c63a5fe9a530649b /src/leap/keymanager/tests/test_validation.py
parenta5cf287dabc77b7172c2f058696cee1024ea3297 (diff)
parentc223cca848e854d0015314ef517a6a4f928a2d0a (diff)
Merge remote-tracking branch 'meskio/feature/6210_key_newer' into develop
Diffstat (limited to 'src/leap/keymanager/tests/test_validation.py')
-rw-r--r--src/leap/keymanager/tests/test_validation.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/leap/keymanager/tests/test_validation.py b/src/leap/keymanager/tests/test_validation.py
index c7170abb..3ae873d4 100644
--- a/src/leap/keymanager/tests/test_validation.py
+++ b/src/leap/keymanager/tests/test_validation.py
@@ -18,6 +18,8 @@
Tests for the Validation Levels
"""
+from datetime import datetime
+
from leap.keymanager.openpgp import OpenPGPKey
from leap.keymanager.errors import (
KeyNotValidUpgrade
@@ -72,6 +74,13 @@ class ValidationLevelTestCase(KeyManagerWithSoledadTestCase):
OpenPGPKey,
validation=ValidationLevel.Provider_Trust)
+ def test_roll_back(self):
+ km = self._key_manager()
+ km.put_raw_key(EXPIRED_KEY_UPDATED, OpenPGPKey)
+ km.put_raw_key(EXPIRED_KEY, OpenPGPKey)
+ key = km.get_key(ADDRESS, OpenPGPKey, fetch_remote=False)
+ self.assertEqual(key.expiry_date, EXPIRED_KEY_NEW_EXPIRY_DATE)
+
# Key material for testing
@@ -144,6 +153,41 @@ Osuse7+NkyUHgMXMVW7cz+nU7iO+ht2rkBtv+Z5LGlzgHTeFjKci
=WhX+
-----END PGP PUBLIC KEY BLOCK-----
"""
+# updated expiration date
+EXPIRED_KEY_NEW_EXPIRY_DATE = datetime.fromtimestamp(2045319180)
+EXPIRED_KEY_UPDATED = """
+-----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