Revert "Add force parameter functional tests"

Reason for revert: Make a stable/2023.2 release that works for other
projects

This reverts commit 7de4f89f02.

Change-Id: I3a28240025839cb0894063efdd5f7d681d430989
This commit is contained in:
Dr. Jens Harbott
2023-09-15 19:43:58 +02:00
parent d8ac096943
commit e2c93e748e

View File

@@ -330,71 +330,6 @@ class BarbicanKeyManagerTestCase(test_key_manager.KeyManagerTestCase):
stored_secret = self.key_mgr.get(self.ctxt, stored_id)
self.assertCountEqual(consumers[1:], stored_secret.consumers)
def test_consumer_add_secret_delete_force_parameter_nonexisting(self):
"""Consumer addition, secret deletion with no 'force' parameter
Creates a secret, adds a consumer to it and tries to delete the secret
without specifying the 'force' parameter.
"""
key = test_key_manager._get_test_passphrase()
self.assertIsNotNone(key)
stored_id = self.key_mgr.store(self.ctxt, key)
self.addCleanup(self.key_mgr.delete, self.ctxt, stored_id, True)
self.assertIsNotNone(stored_id)
consumer = {'service': 'service1',
'resource_type': 'type1',
'resource_id': 'id1'}
self.key_mgr.add_consumer(self.ctxt, stored_id, consumer)
e = self.assertRaises(ValueError, self.key_mgr.delete,
self.ctxt, stored_id)
self.assertIn("Secret has consumers! Remove them first or use the "
"force parameter to delete it.", str(e))
def test_consumer_add_secret_delete_force_parameter_false(self):
"""Consumer addition, secret deletion, 'force' parameter equals False
Creates a secret, adds a consumer to it and tries to delete the secret
specifying the 'force' parameter as False.
"""
key = test_key_manager._get_test_passphrase()
self.assertIsNotNone(key)
stored_id = self.key_mgr.store(self.ctxt, key)
self.addCleanup(self.key_mgr.delete, self.ctxt, stored_id, True)
self.assertIsNotNone(stored_id)
consumer = {'service': 'service1',
'resource_type': 'type1',
'resource_id': 'id1'}
self.key_mgr.add_consumer(self.ctxt, stored_id, consumer)
e = self.assertRaises(ValueError, self.key_mgr.delete,
self.ctxt, stored_id, False)
self.assertIn("Secret has consumers! Remove them first or use the "
"force parameter to delete it.", str(e))
def test_consumer_add_secret_delete_force_parameter_true(self):
"""Consumer addition, secret deletion, 'force' parameter equals True
Creates a secret, adds a consumer to it and deletes the secret,
specifying the 'force' parameter as True.
"""
key = test_key_manager._get_test_passphrase()
self.assertIsNotNone(key)
stored_id = self.key_mgr.store(self.ctxt, key)
self.assertIsNotNone(stored_id)
consumer = {'service': 'service1',
'resource_type': 'type1',
'resource_id': 'id1'}
self.key_mgr.add_consumer(self.ctxt, stored_id, consumer)
self.key_mgr.delete(self.ctxt, stored_id, True)
class BarbicanKeyManagerOSLOContextTestCase(BarbicanKeyManagerTestCase,
base.BaseTestCase):