summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaitlin Farr <kaitlin.farr@jhuapl.edu>2017-06-14 18:33:09 -0400
committerKaitlin Farr <kaitlin.farr@jhuapl.edu>2017-06-19 13:19:01 -0400
commit5bd7b76bd18936150201953a01ba4266f4f47f28 (patch)
tree9a3df8559486cc8a3dabe7f3811d73f85682c24f
parentf2055253e95f240733ea12de1d93b6f8d3208765 (diff)
Fixes for py35
Decodes the bytes in a string type in a few places to get the py35 version of the gate to pass. Change-Id: Ifc66bdeacb09060e3ef699bc15e20f636bf84916
Notes
Notes (review): Code-Review+2: Juan Antonio Osorio Robles <jaosorior@redhat.com> Code-Review+2: Jeremy Liu <liujiong@gohighsec.com> Workflow+1: Jeremy Liu <liujiong@gohighsec.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Tue, 25 Jul 2017 04:28:30 +0000 Reviewed-on: https://review.openstack.org/474374 Project: openstack/barbican-tempest-plugin Branch: refs/heads/master
-rw-r--r--barbican_tempest_plugin/services/key_manager/json/consumer_client.py6
-rw-r--r--barbican_tempest_plugin/services/key_manager/json/container_client.py8
-rw-r--r--barbican_tempest_plugin/services/key_manager/json/order_client.py6
-rw-r--r--barbican_tempest_plugin/services/key_manager/json/quota_client.py6
-rw-r--r--barbican_tempest_plugin/services/key_manager/json/secret_client.py4
5 files changed, 17 insertions, 13 deletions
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):
32 32
33 response, body = self.get(uri) 33 response, body = self.get(uri)
34 self.expected_success(200, response.status) 34 self.expected_success(200, response.status)
35 return json.loads(body) 35 return json.loads(body.decode("utf-8"))
36 36
37 def add_consumer_to_container(self, container_id, **kwargs): 37 def add_consumer_to_container(self, container_id, **kwargs):
38 uri = "/v1/containers/%s/consumers" % container_id 38 uri = "/v1/containers/%s/consumers" % container_id
39 39
40 response, body = self.post(uri, json.dumps(kwargs)) 40 response, body = self.post(uri, json.dumps(kwargs))
41 self.expected_success(200, response.status) 41 self.expected_success(200, response.status)
42 return json.loads(body) 42 return json.loads(body.decode("utf-8"))
43 43
44 def delete_consumer_from_container(self, container_id, **kwargs): 44 def delete_consumer_from_container(self, container_id, **kwargs):
45 uri = "/v1/containers/%s/consumers" % container_id 45 uri = "/v1/containers/%s/consumers" % container_id
46 46
47 response, body = self.delete(uri, body=json.dumps(kwargs)) 47 response, body = self.delete(uri, body=json.dumps(kwargs))
48 self.expected_success(200, response.status) 48 self.expected_success(200, response.status)
49 return json.loads(body) 49 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):
32 32
33 response, body = self.get(uri) 33 response, body = self.get(uri)
34 self.expected_success(200, response.status) 34 self.expected_success(200, response.status)
35 return json.loads(body) 35 return json.loads(body.decode("utf-8"))
36 36
37 def get_container(self, container_id): 37 def get_container(self, container_id):
38 uri = "v1/containers/%s" % container_id 38 uri = "v1/containers/%s" % container_id
39 39
40 response, body = self.get(uri) 40 response, body = self.get(uri)
41 self.expected_success(200, response.status) 41 self.expected_success(200, response.status)
42 return json.loads(body) 42 return json.loads(body.decode("utf-8"))
43 43
44 def create_container(self, **kwargs): 44 def create_container(self, **kwargs):
45 uri = "v1/containers" 45 uri = "v1/containers"
46 46
47 response, body = self.post(uri, json.dumps(kwargs)) 47 response, body = self.post(uri, json.dumps(kwargs))
48 self.expected_success(201, response.status) 48 self.expected_success(201, response.status)
49 return json.loads(body) 49 return json.loads(body.decode("utf-8"))
50 50
51 def delete_container(self, container_id): 51 def delete_container(self, container_id):
52 uri = "v1/containers/%s" % container_id 52 uri = "v1/containers/%s" % container_id
@@ -67,7 +67,7 @@ class ContainerClient(rest_client.RestClient):
67 json.dumps(kwargs) 67 json.dumps(kwargs)
68 ) 68 )
69 self.expected_success(201, response.status) 69 self.expected_success(201, response.status)
70 return json.loads(body) 70 return json.loads(body.decode("utf-8"))
71 71
72 def delete_secret_from_container(self, container_id, secret_id, **kwargs): 72 def delete_secret_from_container(self, container_id, secret_id, **kwargs):
73 uri = "v1/containers/%s/secrets" % container_id 73 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):
32 32
33 response, body = self.get(uri) 33 response, body = self.get(uri)
34 self.expected_success(200, response.status) 34 self.expected_success(200, response.status)
35 return json.loads(body) 35 return json.loads(body.decode("utf-8"))
36 36
37 def create_order(self, **kwargs): 37 def create_order(self, **kwargs):
38 uri = "/v1/orders" 38 uri = "/v1/orders"
39 39
40 response, body = self.post(uri, json.dumps(kwargs)) 40 response, body = self.post(uri, json.dumps(kwargs))
41 self.expected_success(202, response.status) 41 self.expected_success(202, response.status)
42 return json.loads(body) 42 return json.loads(body.decode("utf-8"))
43 43
44 def get_order(self, order_id): 44 def get_order(self, order_id):
45 uri = "v1/orders/%s" % order_id 45 uri = "v1/orders/%s" % order_id
46 46
47 response, body = self.get(uri) 47 response, body = self.get(uri)
48 self.expected_success(200, response.status) 48 self.expected_success(200, response.status)
49 return json.loads(body) 49 return json.loads(body.decode("utf-8"))
50 50
51 def delete_order(self, order_id): 51 def delete_order(self, order_id):
52 uri = "/v1/orders/%s" % order_id 52 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):
32 32
33 response, body = self.get(uri) 33 response, body = self.get(uri)
34 self.expected_success(200, response.status) 34 self.expected_success(200, response.status)
35 return json.loads(body) 35 return json.loads(body.decode("utf-8"))
36 36
37 def get_default_project_quota(self): 37 def get_default_project_quota(self):
38 uri = "v1/quotas" 38 uri = "v1/quotas"
39 39
40 response, body = self.get(uri) 40 response, body = self.get(uri)
41 self.expected_success(200, response.status) 41 self.expected_success(200, response.status)
42 return json.loads(body) 42 return json.loads(body.decode("utf-8"))
43 43
44 def get_project_quota(self, project_id): 44 def get_project_quota(self, project_id):
45 uri = "v1/project-quotas/%s" % project_id 45 uri = "v1/project-quotas/%s" % project_id
46 46
47 response, body = self.get(uri) 47 response, body = self.get(uri)
48 self.expected_success(200, response.status) 48 self.expected_success(200, response.status)
49 return json.loads(body) 49 return json.loads(body.decode("utf-8"))
50 50
51 def create_project_quota(self, project_id, **kwargs): 51 def create_project_quota(self, project_id, **kwargs):
52 uri = "v1/project-quotas/%s" % project_id 52 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 @@
15 15
16 16
17import json 17import json
18import six
18 19
19from tempest import config 20from tempest import config
20from tempest.lib.common import rest_client 21from tempest.lib.common import rest_client
@@ -28,6 +29,9 @@ class SecretClient(rest_client.RestClient):
28 if 'name' not in kwargs: 29 if 'name' not in kwargs:
29 kwargs['name'] = data_utils.rand_name("tempest-sec") 30 kwargs['name'] = data_utils.rand_name("tempest-sec")
30 31
32 if 'payload' in kwargs and type(kwargs['payload']) is six.binary_type:
33 kwargs['payload'] = kwargs['payload'].decode('utf-8')
34
31 post_body = kwargs 35 post_body = kwargs
32 body = json.dumps(post_body) 36 body = json.dumps(post_body)
33 resp, body = self.post("v1/secrets", body) 37 resp, body = self.post("v1/secrets", body)