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
This commit is contained in:
parent
f2055253e9
commit
5bd7b76bd1
|
@ -32,18 +32,18 @@ class ConsumerClient(rest_client.RestClient):
|
||||||
|
|
||||||
response, body = self.get(uri)
|
response, body = self.get(uri)
|
||||||
self.expected_success(200, response.status)
|
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):
|
def add_consumer_to_container(self, container_id, **kwargs):
|
||||||
uri = "/v1/containers/%s/consumers" % container_id
|
uri = "/v1/containers/%s/consumers" % container_id
|
||||||
|
|
||||||
response, body = self.post(uri, json.dumps(kwargs))
|
response, body = self.post(uri, json.dumps(kwargs))
|
||||||
self.expected_success(200, response.status)
|
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):
|
def delete_consumer_from_container(self, container_id, **kwargs):
|
||||||
uri = "/v1/containers/%s/consumers" % container_id
|
uri = "/v1/containers/%s/consumers" % container_id
|
||||||
|
|
||||||
response, body = self.delete(uri, body=json.dumps(kwargs))
|
response, body = self.delete(uri, body=json.dumps(kwargs))
|
||||||
self.expected_success(200, response.status)
|
self.expected_success(200, response.status)
|
||||||
return json.loads(body)
|
return json.loads(body.decode("utf-8"))
|
||||||
|
|
|
@ -32,21 +32,21 @@ class ContainerClient(rest_client.RestClient):
|
||||||
|
|
||||||
response, body = self.get(uri)
|
response, body = self.get(uri)
|
||||||
self.expected_success(200, response.status)
|
self.expected_success(200, response.status)
|
||||||
return json.loads(body)
|
return json.loads(body.decode("utf-8"))
|
||||||
|
|
||||||
def get_container(self, container_id):
|
def get_container(self, container_id):
|
||||||
uri = "v1/containers/%s" % container_id
|
uri = "v1/containers/%s" % container_id
|
||||||
|
|
||||||
response, body = self.get(uri)
|
response, body = self.get(uri)
|
||||||
self.expected_success(200, response.status)
|
self.expected_success(200, response.status)
|
||||||
return json.loads(body)
|
return json.loads(body.decode("utf-8"))
|
||||||
|
|
||||||
def create_container(self, **kwargs):
|
def create_container(self, **kwargs):
|
||||||
uri = "v1/containers"
|
uri = "v1/containers"
|
||||||
|
|
||||||
response, body = self.post(uri, json.dumps(kwargs))
|
response, body = self.post(uri, json.dumps(kwargs))
|
||||||
self.expected_success(201, response.status)
|
self.expected_success(201, response.status)
|
||||||
return json.loads(body)
|
return json.loads(body.decode("utf-8"))
|
||||||
|
|
||||||
def delete_container(self, container_id):
|
def delete_container(self, container_id):
|
||||||
uri = "v1/containers/%s" % container_id
|
uri = "v1/containers/%s" % container_id
|
||||||
|
@ -67,7 +67,7 @@ class ContainerClient(rest_client.RestClient):
|
||||||
json.dumps(kwargs)
|
json.dumps(kwargs)
|
||||||
)
|
)
|
||||||
self.expected_success(201, response.status)
|
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):
|
def delete_secret_from_container(self, container_id, secret_id, **kwargs):
|
||||||
uri = "v1/containers/%s/secrets" % container_id
|
uri = "v1/containers/%s/secrets" % container_id
|
||||||
|
|
|
@ -32,21 +32,21 @@ class OrderClient(rest_client.RestClient):
|
||||||
|
|
||||||
response, body = self.get(uri)
|
response, body = self.get(uri)
|
||||||
self.expected_success(200, response.status)
|
self.expected_success(200, response.status)
|
||||||
return json.loads(body)
|
return json.loads(body.decode("utf-8"))
|
||||||
|
|
||||||
def create_order(self, **kwargs):
|
def create_order(self, **kwargs):
|
||||||
uri = "/v1/orders"
|
uri = "/v1/orders"
|
||||||
|
|
||||||
response, body = self.post(uri, json.dumps(kwargs))
|
response, body = self.post(uri, json.dumps(kwargs))
|
||||||
self.expected_success(202, response.status)
|
self.expected_success(202, response.status)
|
||||||
return json.loads(body)
|
return json.loads(body.decode("utf-8"))
|
||||||
|
|
||||||
def get_order(self, order_id):
|
def get_order(self, order_id):
|
||||||
uri = "v1/orders/%s" % order_id
|
uri = "v1/orders/%s" % order_id
|
||||||
|
|
||||||
response, body = self.get(uri)
|
response, body = self.get(uri)
|
||||||
self.expected_success(200, response.status)
|
self.expected_success(200, response.status)
|
||||||
return json.loads(body)
|
return json.loads(body.decode("utf-8"))
|
||||||
|
|
||||||
def delete_order(self, order_id):
|
def delete_order(self, order_id):
|
||||||
uri = "/v1/orders/%s" % order_id
|
uri = "/v1/orders/%s" % order_id
|
||||||
|
|
|
@ -32,21 +32,21 @@ class QuotaClient(rest_client.RestClient):
|
||||||
|
|
||||||
response, body = self.get(uri)
|
response, body = self.get(uri)
|
||||||
self.expected_success(200, response.status)
|
self.expected_success(200, response.status)
|
||||||
return json.loads(body)
|
return json.loads(body.decode("utf-8"))
|
||||||
|
|
||||||
def get_default_project_quota(self):
|
def get_default_project_quota(self):
|
||||||
uri = "v1/quotas"
|
uri = "v1/quotas"
|
||||||
|
|
||||||
response, body = self.get(uri)
|
response, body = self.get(uri)
|
||||||
self.expected_success(200, response.status)
|
self.expected_success(200, response.status)
|
||||||
return json.loads(body)
|
return json.loads(body.decode("utf-8"))
|
||||||
|
|
||||||
def get_project_quota(self, project_id):
|
def get_project_quota(self, project_id):
|
||||||
uri = "v1/project-quotas/%s" % project_id
|
uri = "v1/project-quotas/%s" % project_id
|
||||||
|
|
||||||
response, body = self.get(uri)
|
response, body = self.get(uri)
|
||||||
self.expected_success(200, response.status)
|
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):
|
def create_project_quota(self, project_id, **kwargs):
|
||||||
uri = "v1/project-quotas/%s" % project_id
|
uri = "v1/project-quotas/%s" % project_id
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import six
|
||||||
|
|
||||||
from tempest import config
|
from tempest import config
|
||||||
from tempest.lib.common import rest_client
|
from tempest.lib.common import rest_client
|
||||||
|
@ -28,6 +29,9 @@ class SecretClient(rest_client.RestClient):
|
||||||
if 'name' not in kwargs:
|
if 'name' not in kwargs:
|
||||||
kwargs['name'] = data_utils.rand_name("tempest-sec")
|
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
|
post_body = kwargs
|
||||||
body = json.dumps(post_body)
|
body = json.dumps(post_body)
|
||||||
resp, body = self.post("v1/secrets", body)
|
resp, body = self.post("v1/secrets", body)
|
||||||
|
|
Loading…
Reference in New Issue