Add test for showing encryption specs item
This patch adds test for the missing API (volume v2): show specific encryption specs item for a volume type. Including: [1] Add show encryption specs item API to v2 encryption_types_client [2] Add unit test for the API [3] Modify test case: test_volume_type_encryption_create_get_update_delete [4] Add release note Change-Id: Idd91e39716f4acf6796412f3f67ef8b6771916f9
This commit is contained in:
parent
9358cfb462
commit
d88a250924
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Add show encryption specs item API to v2 encryption_types_client library.
|
||||||
|
This feature enables the possibility to show specific encryption specs for
|
||||||
|
a volume type.
|
@ -161,6 +161,12 @@ class VolumeTypesTest(base.BaseVolumeAdminTest):
|
|||||||
'The fetched encryption_type %s is different '
|
'The fetched encryption_type %s is different '
|
||||||
'from the updated encryption_type' % key)
|
'from the updated encryption_type' % key)
|
||||||
|
|
||||||
|
# Get encryption specs item
|
||||||
|
key = 'cipher'
|
||||||
|
item = self.admin_encryption_types_client.show_encryption_specs_item(
|
||||||
|
encrypt_type_id, key)
|
||||||
|
self.assertEqual(update_kwargs[key], item[key])
|
||||||
|
|
||||||
# Delete encryption type
|
# Delete encryption type
|
||||||
self.admin_encryption_types_client.delete_encryption_type(
|
self.admin_encryption_types_client.delete_encryption_type(
|
||||||
encrypt_type_id)
|
encrypt_type_id)
|
||||||
|
@ -47,6 +47,14 @@ class EncryptionTypesClient(rest_client.RestClient):
|
|||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
return rest_client.ResponseBody(resp, body)
|
return rest_client.ResponseBody(resp, body)
|
||||||
|
|
||||||
|
def show_encryption_specs_item(self, volume_type_id, key):
|
||||||
|
"""Get the encryption specs item for the specified volume type."""
|
||||||
|
url = "/types/%s/encryption/%s" % (volume_type_id, key)
|
||||||
|
resp, body = self.get(url)
|
||||||
|
body = json.loads(body)
|
||||||
|
self.expected_success(200, resp.status)
|
||||||
|
return rest_client.ResponseBody(resp, body)
|
||||||
|
|
||||||
def create_encryption_type(self, volume_type_id, **kwargs):
|
def create_encryption_type(self, volume_type_id, **kwargs):
|
||||||
"""Create encryption type.
|
"""Create encryption type.
|
||||||
|
|
||||||
|
@ -43,6 +43,10 @@ class TestEncryptionTypesClient(base.BaseServiceTest):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FAKE_ENCRYPTION_SPECS_ITEM = {
|
||||||
|
"cipher": "aes-xts-plain64"
|
||||||
|
}
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestEncryptionTypesClient, self).setUp()
|
super(TestEncryptionTypesClient, self).setUp()
|
||||||
fake_auth = fake_auth_provider.FakeAuthProvider()
|
fake_auth = fake_auth_provider.FakeAuthProvider()
|
||||||
@ -65,6 +69,13 @@ class TestEncryptionTypesClient(base.BaseServiceTest):
|
|||||||
self.FAKE_INFO_ENCRYPTION_TYPE,
|
self.FAKE_INFO_ENCRYPTION_TYPE,
|
||||||
bytes_body, volume_type_id="cbc36478b0bd8e67e89")
|
bytes_body, volume_type_id="cbc36478b0bd8e67e89")
|
||||||
|
|
||||||
|
def _test_show_encryption_specs_item(self, bytes_body=False):
|
||||||
|
self.check_service_client_function(
|
||||||
|
self.client.show_encryption_specs_item,
|
||||||
|
'tempest.lib.common.rest_client.RestClient.get',
|
||||||
|
self.FAKE_ENCRYPTION_SPECS_ITEM,
|
||||||
|
bytes_body, volume_type_id="cbc36478b0bd8e67e89", key="cipher")
|
||||||
|
|
||||||
def test_create_encryption_type_with_str_body(self):
|
def test_create_encryption_type_with_str_body(self):
|
||||||
self._test_create_encryption()
|
self._test_create_encryption()
|
||||||
|
|
||||||
@ -77,6 +88,12 @@ class TestEncryptionTypesClient(base.BaseServiceTest):
|
|||||||
def test_show_encryption_type_with_bytes_body(self):
|
def test_show_encryption_type_with_bytes_body(self):
|
||||||
self._test_show_encryption_type(bytes_body=True)
|
self._test_show_encryption_type(bytes_body=True)
|
||||||
|
|
||||||
|
def test_show_encryption_specs_item_with_str_body(self):
|
||||||
|
self._test_show_encryption_specs_item()
|
||||||
|
|
||||||
|
def test_show_encryption_specs_item_with_bytes_body(self):
|
||||||
|
self._test_show_encryption_specs_item(bytes_body=True)
|
||||||
|
|
||||||
def test_delete_encryption_type(self):
|
def test_delete_encryption_type(self):
|
||||||
self.check_service_client_function(
|
self.check_service_client_function(
|
||||||
self.client.delete_encryption_type,
|
self.client.delete_encryption_type,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user