Merge "add unittest for volume encryption types"

This commit is contained in:
Zuul 2019-07-12 09:23:17 +00:00 committed by Gerrit Code Review
commit ef47489dc1

View File

@ -30,6 +30,15 @@ class TestEncryptionTypesClient(base.BaseServiceTest):
}
}
UPDATE_ENCRYPTION_TYPE = {
"encryption": {
"key_size": 64,
"provider": "LuksEncryptor",
"control_location": "front-end",
"cipher": "aes-xts-plain64"
}
}
FAKE_INFO_ENCRYPTION_TYPE = {
"encryption": {
"name": "FakeEncryptionType",
@ -50,10 +59,8 @@ class TestEncryptionTypesClient(base.BaseServiceTest):
def setUp(self):
super(TestEncryptionTypesClient, self).setUp()
fake_auth = fake_auth_provider.FakeAuthProvider()
self.client = encryption_types_client.EncryptionTypesClient(fake_auth,
'volume',
'regionOne'
)
self.client = encryption_types_client.EncryptionTypesClient(
fake_auth, 'volume', 'regionOne')
def _test_create_encryption(self, bytes_body=False):
self.check_service_client_function(
@ -101,3 +108,16 @@ class TestEncryptionTypesClient(base.BaseServiceTest):
{},
volume_type_id="cbc36478b0bd8e67e89",
status=202)
def test_update_encryption_type_with_str_body(self):
self._test_update_encryption_type()
def test_update_encryption_type_with_bytes_body(self):
self._test_update_encryption_type(bytes_body=True)
def _test_update_encryption_type(self, bytes_body=False):
self.check_service_client_function(
self.client.update_encryption_type,
'tempest.lib.common.rest_client.RestClient.put',
self.UPDATE_ENCRYPTION_TYPE,
bytes_body, volume_type_id="cbc36478b0bd8e67e89")