summaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
authorTulio Casagrande <tcasagra@thoughtworks.com>2017-04-10 18:52:20 -0300
committerRuben Pollan <meskio@sindominio.net>2017-12-03 20:43:37 +0100
commit85c0e9b95dfc3d7134e47aac7e7e485270b42b96 (patch)
treefce3f93d1126af00fb01e872f0b720106cddabaf /tests/integration
parent873012e432cd6125c3174a2bc6ef9498166d94ea (diff)
[bug] remove change_key_expiration from the API
This was intended to offer the option of only extend the old key and not change it for a new one. However, we don't plan to use this behavior anymore.
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/keymanager/test_keymanager.py60
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(