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
This commit is contained in:
ghanshyam
2015-08-04 15:42:24 +09:00
parent 86f5893af5
commit c7e09bf678
2 changed files with 5 additions and 4 deletions

View File

@@ -24,13 +24,14 @@ class CertificatesV2TestJSON(base.BaseComputeTest):
@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)

View File

@@ -26,7 +26,7 @@ class CertificatesClient(service_client.ServiceClient):
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 @@ class CertificatesClient(service_client.ServiceClient):
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)