Unify the format of list response
Change the format of container_actions response for consistency with other APIs. Right now, all the list response is of the following format: {"xxx" [{...}, ...]} Change-Id: I388548a1c15e61b62e802da634c7be8697ff05b9
This commit is contained in:
parent
744a17376e
commit
d99faddc5a
@ -1,21 +1,22 @@
|
|||||||
[
|
{
|
||||||
{
|
"containerActions": [
|
||||||
"action": "create",
|
{
|
||||||
"container_uuid": "b48316c5-71e8-45e4-9884-6c78055b9b13",
|
"action": "create",
|
||||||
"message": null,
|
"container_uuid": "b48316c5-71e8-45e4-9884-6c78055b9b13",
|
||||||
"project_id": "853719b303ef4858a195535eb520e58d",
|
"message": null,
|
||||||
"request_id": "req-25517360-b757-47d3-be45-0e8d2a01b36a",
|
"project_id": "853719b303ef4858a195535eb520e58d",
|
||||||
"start_time": "2018-03-04 19:48:49+00:00",
|
"request_id": "req-25517360-b757-47d3-be45-0e8d2a01b36a",
|
||||||
"user_id": "22e81669093742b7a74b1d715a9a5813"
|
"start_time": "2018-03-04 19:48:49+00:00",
|
||||||
},
|
"user_id": "22e81669093742b7a74b1d715a9a5813"
|
||||||
{
|
},
|
||||||
"action": "stop",
|
{
|
||||||
"container_uuid": "b48316c5-71e8-45e4-9884-6c78055b9b13",
|
"action": "stop",
|
||||||
"message": null,
|
"container_uuid": "b48316c5-71e8-45e4-9884-6c78055b9b13",
|
||||||
"project_id": "853719b303ef4858a195535eb520e58d",
|
"message": null,
|
||||||
"request_id": "req-3293a3f1-b44c-4609-b8d2-d81b105636b8",
|
"project_id": "853719b303ef4858a195535eb520e58d",
|
||||||
"start_time": "2018-03-04 17:02:54+00:00",
|
"request_id": "req-3293a3f1-b44c-4609-b8d2-d81b105636b8",
|
||||||
"user_id": "22e81669093742b7a74b1d715a9a5813"
|
"start_time": "2018-03-04 17:02:54+00:00",
|
||||||
}
|
"user_id": "22e81669093742b7a74b1d715a9a5813"
|
||||||
]
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
@ -115,7 +115,7 @@ class ContainersActionsController(base.Controller):
|
|||||||
context, container.uuid)
|
context, container.uuid)
|
||||||
actions = [self._format_action(action) for action in actions_raw]
|
actions = [self._format_action(action) for action in actions_raw]
|
||||||
|
|
||||||
return actions
|
return {"containerActions": actions}
|
||||||
|
|
||||||
@pecan.expose('json')
|
@pecan.expose('json')
|
||||||
@exception.wrap_pecan_controller_exception
|
@exception.wrap_pecan_controller_exception
|
||||||
|
@ -1910,8 +1910,9 @@ class TestContainerActionController(api_base.FunctionalTest):
|
|||||||
test_container['uuid'])
|
test_container['uuid'])
|
||||||
|
|
||||||
self.assertEqual(200, response.status_int)
|
self.assertEqual(200, response.status_int)
|
||||||
self.assertEqual(self._format_action(test_action),
|
self.assertEqual(
|
||||||
self._format_action(response.json[0]))
|
self._format_action(test_action),
|
||||||
|
self._format_action(response.json['containerActions'][0]))
|
||||||
|
|
||||||
@mock.patch('zun.objects.Container.get_by_uuid')
|
@mock.patch('zun.objects.Container.get_by_uuid')
|
||||||
@mock.patch('zun.common.policy.enforce')
|
@mock.patch('zun.common.policy.enforce')
|
||||||
|
Loading…
Reference in New Issue
Block a user