Remove unnecessary str() from base_types_client
Volume IDs and the other parameters are passed as string and Tempest
doesn't need str() calls for them.
This patch removes these str() for the code cleanup.
Change-Id: Ic5e6e9d52aca78f1171ef1ee827f6c4cef848c67
diff --git a/tempest/services/volume/base/admin/base_types_client.py b/tempest/services/volume/base/admin/base_types_client.py
index afca752..fcb537e 100755
--- a/tempest/services/volume/base/admin/base_types_client.py
+++ b/tempest/services/volume/base/admin/base_types_client.py
@@ -68,7 +68,7 @@
Available params: see http://developer.openstack.org/
api-ref-blockstorage-v2.html#showVolumeType
"""
- url = "types/%s" % str(volume_id)
+ url = "types/%s" % volume_id
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
@@ -92,7 +92,7 @@
Available params: see http://developer.openstack.org/
api-ref-blockstorage-v2.html#deleteVolumeType
"""
- resp, body = self.delete("types/%s" % str(volume_id))
+ resp, body = self.delete("types/%s" % volume_id)
self.expected_success(202, resp.status)
return rest_client.ResponseBody(resp, body)
@@ -103,7 +103,7 @@
After fixing the api-site, we need to fix here also for putting
the link to api-site.
"""
- url = 'types/%s/extra_specs' % str(vol_type_id)
+ url = 'types/%s/extra_specs' % vol_type_id
if params:
url += '?%s' % urllib.urlencode(params)
@@ -114,8 +114,7 @@
def show_volume_type_extra_specs(self, vol_type_id, extra_specs_name):
"""Returns the details of a single volume_type extra spec."""
- url = "types/%s/extra_specs/%s" % (str(vol_type_id),
- str(extra_specs_name))
+ url = "types/%s/extra_specs/%s" % (vol_type_id, extra_specs_name)
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
@@ -127,7 +126,7 @@
vol_type_id: Id of volume_type.
extra_specs: A dictionary of values to be used as extra_specs.
"""
- url = "types/%s/extra_specs" % str(vol_type_id)
+ url = "types/%s/extra_specs" % vol_type_id
post_body = json.dumps({'extra_specs': extra_specs})
resp, body = self.post(url, post_body)
body = json.loads(body)
@@ -137,7 +136,7 @@
def delete_volume_type_extra_specs(self, vol_id, extra_spec_name):
"""Deletes the Specified Volume_type extra spec."""
resp, body = self.delete("types/%s/extra_specs/%s" % (
- (str(vol_id)), str(extra_spec_name)))
+ vol_id, extra_spec_name))
self.expected_success(202, resp.status)
return rest_client.ResponseBody(resp, body)
@@ -153,8 +152,7 @@
api-ref-blockstorage-v2.html#
updateVolumeTypeExtraSpecs
"""
- url = "types/%s/extra_specs/%s" % (str(vol_type_id),
- str(extra_spec_name))
+ url = "types/%s/extra_specs/%s" % (vol_type_id, extra_spec_name)
put_body = json.dumps(extra_specs)
resp, body = self.put(url, put_body)
body = json.loads(body)
@@ -166,7 +164,7 @@
vol_type_id: Id of volume_type.
"""
- url = "/types/%s/encryption" % str(vol_type_id)
+ url = "/types/%s/encryption" % vol_type_id
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
@@ -179,7 +177,7 @@
After fixing the api-site, we need to fix here also for putting
the link to api-site.
"""
- url = "/types/%s/encryption" % str(vol_type_id)
+ url = "/types/%s/encryption" % vol_type_id
post_body = json.dumps({'encryption': kwargs})
resp, body = self.post(url, post_body)
body = json.loads(body)
@@ -189,7 +187,7 @@
def delete_encryption_type(self, vol_type_id):
"""Delete the encryption type for the specified volume-type."""
resp, body = self.delete(
- "/types/%s/encryption/provider" % str(vol_type_id))
+ "/types/%s/encryption/provider" % vol_type_id)
self.expected_success(202, resp.status)
return rest_client.ResponseBody(resp, body)