diff --git a/barbican_tempest_plugin/services/key_manager/json/consumer_client.py b/barbican_tempest_plugin/services/key_manager/json/consumer_client.py index e76400a..e0ed5a5 100644 --- a/barbican_tempest_plugin/services/key_manager/json/consumer_client.py +++ b/barbican_tempest_plugin/services/key_manager/json/consumer_client.py @@ -32,18 +32,18 @@ class ConsumerClient(rest_client.RestClient): response, body = self.get(uri) self.expected_success(200, response.status) - return json.loads(body) + return json.loads(body.decode("utf-8")) def add_consumer_to_container(self, container_id, **kwargs): uri = "/v1/containers/%s/consumers" % container_id response, body = self.post(uri, json.dumps(kwargs)) self.expected_success(200, response.status) - return json.loads(body) + return json.loads(body.decode("utf-8")) def delete_consumer_from_container(self, container_id, **kwargs): uri = "/v1/containers/%s/consumers" % container_id response, body = self.delete(uri, body=json.dumps(kwargs)) self.expected_success(200, response.status) - return json.loads(body) + return json.loads(body.decode("utf-8")) diff --git a/barbican_tempest_plugin/services/key_manager/json/container_client.py b/barbican_tempest_plugin/services/key_manager/json/container_client.py index ebae08e..7bacf03 100644 --- a/barbican_tempest_plugin/services/key_manager/json/container_client.py +++ b/barbican_tempest_plugin/services/key_manager/json/container_client.py @@ -32,21 +32,21 @@ class ContainerClient(rest_client.RestClient): response, body = self.get(uri) self.expected_success(200, response.status) - return json.loads(body) + return json.loads(body.decode("utf-8")) def get_container(self, container_id): uri = "v1/containers/%s" % container_id response, body = self.get(uri) self.expected_success(200, response.status) - return json.loads(body) + return json.loads(body.decode("utf-8")) def create_container(self, **kwargs): uri = "v1/containers" response, body = self.post(uri, json.dumps(kwargs)) self.expected_success(201, response.status) - return json.loads(body) + return json.loads(body.decode("utf-8")) def delete_container(self, container_id): uri = "v1/containers/%s" % container_id @@ -67,7 +67,7 @@ class ContainerClient(rest_client.RestClient): json.dumps(kwargs) ) self.expected_success(201, response.status) - return json.loads(body) + return json.loads(body.decode("utf-8")) def delete_secret_from_container(self, container_id, secret_id, **kwargs): uri = "v1/containers/%s/secrets" % container_id diff --git a/barbican_tempest_plugin/services/key_manager/json/order_client.py b/barbican_tempest_plugin/services/key_manager/json/order_client.py index ba0ce51..85455b7 100644 --- a/barbican_tempest_plugin/services/key_manager/json/order_client.py +++ b/barbican_tempest_plugin/services/key_manager/json/order_client.py @@ -32,21 +32,21 @@ class OrderClient(rest_client.RestClient): response, body = self.get(uri) self.expected_success(200, response.status) - return json.loads(body) + return json.loads(body.decode("utf-8")) def create_order(self, **kwargs): uri = "/v1/orders" response, body = self.post(uri, json.dumps(kwargs)) self.expected_success(202, response.status) - return json.loads(body) + return json.loads(body.decode("utf-8")) def get_order(self, order_id): uri = "v1/orders/%s" % order_id response, body = self.get(uri) self.expected_success(200, response.status) - return json.loads(body) + return json.loads(body.decode("utf-8")) def delete_order(self, order_id): uri = "/v1/orders/%s" % order_id diff --git a/barbican_tempest_plugin/services/key_manager/json/quota_client.py b/barbican_tempest_plugin/services/key_manager/json/quota_client.py index 2f90546..f874648 100644 --- a/barbican_tempest_plugin/services/key_manager/json/quota_client.py +++ b/barbican_tempest_plugin/services/key_manager/json/quota_client.py @@ -32,21 +32,21 @@ class QuotaClient(rest_client.RestClient): response, body = self.get(uri) self.expected_success(200, response.status) - return json.loads(body) + return json.loads(body.decode("utf-8")) def get_default_project_quota(self): uri = "v1/quotas" response, body = self.get(uri) self.expected_success(200, response.status) - return json.loads(body) + return json.loads(body.decode("utf-8")) def get_project_quota(self, project_id): uri = "v1/project-quotas/%s" % project_id response, body = self.get(uri) self.expected_success(200, response.status) - return json.loads(body) + return json.loads(body.decode("utf-8")) def create_project_quota(self, project_id, **kwargs): uri = "v1/project-quotas/%s" % project_id diff --git a/barbican_tempest_plugin/services/key_manager/json/secret_client.py b/barbican_tempest_plugin/services/key_manager/json/secret_client.py index 0402eef..4958c25 100644 --- a/barbican_tempest_plugin/services/key_manager/json/secret_client.py +++ b/barbican_tempest_plugin/services/key_manager/json/secret_client.py @@ -15,6 +15,7 @@ import json +import six from tempest import config from tempest.lib.common import rest_client @@ -28,6 +29,9 @@ class SecretClient(rest_client.RestClient): if 'name' not in kwargs: kwargs['name'] = data_utils.rand_name("tempest-sec") + if 'payload' in kwargs and type(kwargs['payload']) is six.binary_type: + kwargs['payload'] = kwargs['payload'].decode('utf-8') + post_body = kwargs body = json.dumps(post_body) resp, body = self.post("v1/secrets", body)