Return complete response from compute certificates_client
Currently compute certificates_client returns Response by removing
top key from Response.
For example-
return service_client.ResponseBody(resp, body['certificate'])
As service clients are in direction to move to Tempest-lib, all
service clients should return Response without any truncation.
One good example is Resource pagination links which are lost with current
way of return value. Resource pagination links are present in parallel
(not inside) to top key of Response.
This patch makes compute certificates_client to return complete
Response body.
Change-Id: Ia97c34f15aa06e11434ea9f66359adbca75bd9d4
Implements: blueprint method-return-value-and-move-service-clients-to-lib
diff --git a/tempest/api/compute/certificates/test_certificates.py b/tempest/api/compute/certificates/test_certificates.py
index 5f68786..78a0a93 100644
--- a/tempest/api/compute/certificates/test_certificates.py
+++ b/tempest/api/compute/certificates/test_certificates.py
@@ -24,13 +24,14 @@
@test.idempotent_id('c070a441-b08e-447e-a733-905909535b1b')
def test_create_root_certificate(self):
# create certificates
- body = self.certificates_client.create_certificate()
+ body = self.certificates_client.create_certificate()['certificate']
self.assertIn('data', body)
self.assertIn('private_key', body)
@test.idempotent_id('3ac273d0-92d2-4632-bdfc-afbc21d4606c')
def test_get_root_certificate(self):
# get the root certificate
- body = self.certificates_client.show_certificate('root')
+ body = (self.certificates_client.show_certificate('root')
+ ['certificate'])
self.assertIn('data', body)
self.assertIn('private_key', body)
diff --git a/tempest/services/compute/json/certificates_client.py b/tempest/services/compute/json/certificates_client.py
index c25b273..d6c72f4 100644
--- a/tempest/services/compute/json/certificates_client.py
+++ b/tempest/services/compute/json/certificates_client.py
@@ -26,7 +26,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_certificate, resp, body)
- return service_client.ResponseBody(resp, body['certificate'])
+ return service_client.ResponseBody(resp, body)
def create_certificate(self):
"""create certificates."""
@@ -34,4 +34,4 @@
resp, body = self.post(url, None)
body = json.loads(body)
self.validate_response(schema.create_certificate, resp, body)
- return service_client.ResponseBody(resp, body['certificate'])
+ return service_client.ResponseBody(resp, body)