diff options
Diffstat (limited to 'tests/integration/keymanager/test_keymanager.py')
-rw-r--r-- | tests/integration/keymanager/test_keymanager.py | 60 |
1 files changed, 2 insertions, 58 deletions
diff --git a/tests/integration/keymanager/test_keymanager.py b/tests/integration/keymanager/test_keymanager.py index 334b3356..88a8ba93 100644 --- a/tests/integration/keymanager/test_keymanager.py +++ b/tests/integration/keymanager/test_keymanager.py @@ -21,7 +21,7 @@ import json import urllib import tempfile import pkg_resources -from datetime import datetime, timedelta, date +from datetime import datetime, date from twisted.internet import defer from twisted.trial import unittest @@ -31,7 +31,6 @@ import mock from leap.common import ca_bundle from leap.bitmask.keymanager import errors -from leap.bitmask.keymanager.errors import KeyExpirationError from leap.bitmask.keymanager.keys import ( OpenPGPKey, is_address, @@ -652,61 +651,6 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase): km._openpgp.reset_all_keys_sign_used.assert_called_once() - @defer.inlineCallbacks - def test_keymanager_change_key_expiry_date_for_key_pair(self): - km = self._key_manager(user=ADDRESS_EXPIRING) - - yield km._openpgp.put_raw_key(PRIVATE_EXPIRING_KEY, ADDRESS_EXPIRING) - key = yield km.get_key(ADDRESS_EXPIRING, fetch_remote=False) - - yield km.change_key_expiration(expiration_time='1w') - - new_expiry_date = date.today() + timedelta(weeks=1) - - renewed_public_key = yield km.get_key(ADDRESS_EXPIRING, - fetch_remote=False) - renewed_private_key = yield km.get_key(ADDRESS_EXPIRING, private=True) - - self.assertEqual(new_expiry_date, - renewed_public_key.expiry_date.date()) - self.assertEqual(new_expiry_date, - renewed_private_key.expiry_date.date()) - self.assertEqual(key.fingerprint, renewed_public_key.fingerprint) - self.assertEqual(key.fingerprint, renewed_private_key.fingerprint) - - @defer.inlineCallbacks - def test_change_key_expiration_resets_all_public_key_sign_used(self): - km = self._key_manager(user=ADDRESS_EXPIRING) - - yield km._openpgp.put_raw_key(PRIVATE_EXPIRING_KEY, ADDRESS_EXPIRING) - km._openpgp.reset_all_keys_sign_used = mock.Mock() - - yield km.change_key_expiration(expiration_time='1w') - - km._openpgp.reset_all_keys_sign_used.assert_called_once() - - @defer.inlineCallbacks - def test_change_key_expiration_with_invalid_period_throws_exception(self): - km = self._key_manager(user=ADDRESS_EXPIRING) - - yield km._openpgp.put_raw_key(PRIVATE_EXPIRING_KEY, ADDRESS_EXPIRING) - key = yield km.get_key(ADDRESS_EXPIRING, fetch_remote=False) - - invalid_expiration_time_option = '2xw' - - with self.assertRaises(KeyExpirationError): - yield km.change_key_expiration( - expiration_time=invalid_expiration_time_option) - - renewed_public_key = yield km.get_key(ADDRESS_EXPIRING, - fetch_remote=False) - renewed_private_key = yield km.get_key(ADDRESS_EXPIRING, private=True) - - self.assertEqual(key.expiry_date, renewed_public_key.expiry_date) - self.assertEqual(key.expiry_date, renewed_private_key.expiry_date) - self.assertEqual(key.fingerprint, renewed_public_key.fingerprint) - self.assertEqual(key.fingerprint, renewed_private_key.fingerprint) - class KeyManagerCryptoTestCase(KeyManagerWithSoledadTestCase): RAW_DATA = 'data' @@ -740,7 +684,7 @@ class KeyManagerCryptoTestCase(KeyManagerWithSoledadTestCase): self.assertNotEqual(self.RAW_DATA, encdata) # renew key - new_key = yield km.regenerate_key() + yield km.regenerate_key() # decrypt rawdata, signingkey = yield km.decrypt( |