Return complete response from compute baremetal client
Currently compute baremetal_nodes_client returns Response by removing top key from Response. For example- return service_client.ResponseBody(resp, body['node']) 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 baremetal_nodes_client to return complete Response body. Change-Id: I93a0e82063900ffd1893e63a992f9f827c5b5ae2 Implements: blueprint method-return-value-and-move-service-clients-to-lib
This commit is contained in:
@@ -46,11 +46,11 @@ class BaremetalNodesAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
# List all baremetal nodes and ensure our created test nodes are
|
||||
# listed
|
||||
bm_node_ids = set([n['id'] for n in
|
||||
self.client.list_baremetal_nodes()])
|
||||
self.client.list_baremetal_nodes()['nodes']])
|
||||
test_node_ids = set([n['uuid'] for n in test_nodes])
|
||||
self.assertTrue(test_node_ids.issubset(bm_node_ids))
|
||||
|
||||
# Test getting each individually
|
||||
for node in test_nodes:
|
||||
baremetal_node = self.client.show_baremetal_node(node['uuid'])
|
||||
self.assertEqual(node['uuid'], baremetal_node['id'])
|
||||
self.assertEqual(node['uuid'], baremetal_node['node']['id'])
|
||||
|
||||
@@ -33,7 +33,7 @@ class BaremetalNodesClient(service_client.ServiceClient):
|
||||
resp, body = self.get(url)
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.list_baremetal_nodes, resp, body)
|
||||
return service_client.ResponseBodyList(resp, body['nodes'])
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def show_baremetal_node(self, baremetal_node_id):
|
||||
"""Returns the details of a single baremetal node."""
|
||||
@@ -41,4 +41,4 @@ class BaremetalNodesClient(service_client.ServiceClient):
|
||||
resp, body = self.get(url)
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.get_baremetal_node, resp, body)
|
||||
return service_client.ResponseBody(resp, body['node'])
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
Reference in New Issue
Block a user