From a52572347540194643874a2b365436093d2bbe9c Mon Sep 17 00:00:00 2001 From: wanglbj Date: Tue, 9 Jul 2019 19:17:02 +0800 Subject: [PATCH] add unittest for volume encryption types Change-Id: I7c45acbbf5e1b312ed4477bb25b5d1a5b533ccc8 --- .../volume/v3/test_encryption_types_client.py | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/tempest/tests/lib/services/volume/v3/test_encryption_types_client.py b/tempest/tests/lib/services/volume/v3/test_encryption_types_client.py index c788181e23..87bd379a5c 100644 --- a/tempest/tests/lib/services/volume/v3/test_encryption_types_client.py +++ b/tempest/tests/lib/services/volume/v3/test_encryption_types_client.py @@ -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")