diff options
author | Zara Gebru <zgebru@thoughtworks.com> | 2016-06-16 14:41:54 +0200 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2017-01-26 14:55:11 +0100 |
commit | 847bc7ddd051c4656d86a6eda1b4e6cbdb5b1c5e (patch) | |
tree | fd61837900c65efd44021b7d1fff59c8085a8bff /tests/integration/keymanager/test_validation.py | |
parent | 9932121dd3da2611f14a59b27c40042dadff80a3 (diff) |
Check validity of key signature
Check if a new fetched key was signed by a old key with the same address.
Please do not merge before: https://github.com/isislovecruft/python-gnupg/pull/150
- Resolves #8112
Diffstat (limited to 'tests/integration/keymanager/test_validation.py')
-rw-r--r-- | tests/integration/keymanager/test_validation.py | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/tests/integration/keymanager/test_validation.py b/tests/integration/keymanager/test_validation.py index dccd0f6..aa29712 100644 --- a/tests/integration/keymanager/test_validation.py +++ b/tests/integration/keymanager/test_validation.py @@ -23,15 +23,20 @@ from twisted.internet.defer import inlineCallbacks from leap.bitmask.keymanager.errors import KeyNotValidUpgrade from leap.bitmask.keymanager.validation import ValidationLevels +from leap.bitmask.keymanager.testing import KeyManagerWithSoledadTestCase -from leap.bitmask.keymanager.testing import ( - KeyManagerWithSoledadTestCase, +from common import ( ADDRESS, PUBLIC_KEY, ADDRESS_2, PUBLIC_KEY_2, PRIVATE_KEY_2, - KEY_FINGERPRINT + KEY_FINGERPRINT, + NEW_PUB_KEY, + NEW_PUB_KEY_FINGERPRINT, + OLD_AND_NEW_KEY_ADDRESS, + OLD_PUB_KEY_FINGERPRINT, + OLD_PUB_KEY ) @@ -81,6 +86,19 @@ class ValidationLevelsTestCase(KeyManagerWithSoledadTestCase): yield self.assertFailure(d, KeyNotValidUpgrade) @inlineCallbacks + def test_can_upgrade_key(self): + km = self._key_manager() + + yield km.put_raw_key(OLD_PUB_KEY, OLD_AND_NEW_KEY_ADDRESS) + old_key = yield km.get_key(OLD_AND_NEW_KEY_ADDRESS, fetch_remote=False) + self.assertEquals(old_key.fingerprint, OLD_PUB_KEY_FINGERPRINT) + + yield km.put_raw_key(NEW_PUB_KEY, OLD_AND_NEW_KEY_ADDRESS) + + new_key = yield km.get_key(OLD_AND_NEW_KEY_ADDRESS, fetch_remote=False) + self.assertEquals(new_key.fingerprint, NEW_PUB_KEY_FINGERPRINT) + + @inlineCallbacks def test_roll_back(self): km = self._key_manager() yield km.put_raw_key(EXPIRED_KEY_UPDATED, ADDRESS) |