Merge "Return complete response from compute extensions_client"

This commit is contained in:
Jenkins 2015-08-24 15:35:38 +00:00 committed by Gerrit Code Review
commit b7ad53bed3
3 changed files with 8 additions and 8 deletions

View File

@ -32,7 +32,7 @@ class ExtensionsTestJSON(base.BaseV2ComputeTest):
# List of all extensions
if len(CONF.compute_feature_enabled.api_extensions) == 0:
raise self.skipException('There are not any extensions configured')
extensions = self.extensions_client.list_extensions()
extensions = self.extensions_client.list_extensions()['extensions']
ext = CONF.compute_feature_enabled.api_extensions[0]
if ext == 'all':
self.assertIn('Hosts', map(lambda x: x['name'], extensions))
@ -49,4 +49,4 @@ class ExtensionsTestJSON(base.BaseV2ComputeTest):
def test_get_extension(self):
# get the specified extensions
extension = self.extensions_client.show_extension('os-consoles')
self.assertEqual('os-consoles', extension['alias'])
self.assertEqual('os-consoles', extension['extension']['alias'])

View File

@ -26,9 +26,9 @@ class ExtensionsClient(service_client.ServiceClient):
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_extensions, resp, body)
return service_client.ResponseBodyList(resp, body['extensions'])
return service_client.ResponseBody(resp, body)
def show_extension(self, extension_alias):
resp, body = self.get('extensions/%s' % extension_alias)
body = json.loads(body)
return service_client.ResponseBody(resp, body['extension'])
return service_client.ResponseBody(resp, body)

View File

@ -34,7 +34,7 @@ class TestExtensionsClient(base.TestCase):
body = '{"extensions": []}'
if bytes_body:
body = body.encode('utf-8')
expected = []
expected = {"extensions": []}
response = (httplib2.Response({'status': 200}), body)
self.useFixture(mockpatch.Patch(
'tempest.common.service_client.ServiceClient.get',
@ -48,7 +48,7 @@ class TestExtensionsClient(base.TestCase):
self._test_list_extensions(bytes_body=True)
def _test_show_extension(self, bytes_body=False):
expected = {
expected = {"extension": {
"updated": "2011-06-09T00:00:00Z",
"name": "Multinic",
"links": [],
@ -56,8 +56,8 @@ class TestExtensionsClient(base.TestCase):
"http://docs.openstack.org/compute/ext/multinic/api/v1.1",
"alias": "NMN",
"description": u'\u2740(*\xb4\u25e1`*)\u2740'
}
serialized_body = json.dumps({"extension": expected})
}}
serialized_body = json.dumps(expected)
if bytes_body:
serialized_body = serialized_body.encode('utf-8')