Merge "Unify the format of list response"

This commit is contained in:
Zuul 2018-04-27 09:45:07 +00:00 committed by Gerrit Code Review
commit 4859641408
3 changed files with 26 additions and 24 deletions

View File

@ -1,21 +1,22 @@
[
{
"action": "create",
"container_uuid": "b48316c5-71e8-45e4-9884-6c78055b9b13",
"message": null,
"project_id": "853719b303ef4858a195535eb520e58d",
"request_id": "req-25517360-b757-47d3-be45-0e8d2a01b36a",
"start_time": "2018-03-04 19:48:49+00:00",
"user_id": "22e81669093742b7a74b1d715a9a5813"
},
{
"action": "stop",
"container_uuid": "b48316c5-71e8-45e4-9884-6c78055b9b13",
"message": null,
"project_id": "853719b303ef4858a195535eb520e58d",
"request_id": "req-3293a3f1-b44c-4609-b8d2-d81b105636b8",
"start_time": "2018-03-04 17:02:54+00:00",
"user_id": "22e81669093742b7a74b1d715a9a5813"
}
]
{
"containerActions": [
{
"action": "create",
"container_uuid": "b48316c5-71e8-45e4-9884-6c78055b9b13",
"message": null,
"project_id": "853719b303ef4858a195535eb520e58d",
"request_id": "req-25517360-b757-47d3-be45-0e8d2a01b36a",
"start_time": "2018-03-04 19:48:49+00:00",
"user_id": "22e81669093742b7a74b1d715a9a5813"
},
{
"action": "stop",
"container_uuid": "b48316c5-71e8-45e4-9884-6c78055b9b13",
"message": null,
"project_id": "853719b303ef4858a195535eb520e58d",
"request_id": "req-3293a3f1-b44c-4609-b8d2-d81b105636b8",
"start_time": "2018-03-04 17:02:54+00:00",
"user_id": "22e81669093742b7a74b1d715a9a5813"
}
]
}

View File

@ -114,7 +114,7 @@ class ContainersActionsController(base.Controller):
context, container.uuid)
actions = [self._format_action(action) for action in actions_raw]
return actions
return {"containerActions": actions}
@pecan.expose('json')
@exception.wrap_pecan_controller_exception

View File

@ -1933,8 +1933,9 @@ class TestContainerActionController(api_base.FunctionalTest):
test_container['uuid'])
self.assertEqual(200, response.status_int)
self.assertEqual(self._format_action(test_action),
self._format_action(response.json[0]))
self.assertEqual(
self._format_action(test_action),
self._format_action(response.json['containerActions'][0]))
@mock.patch('zun.objects.Container.get_by_uuid')
@mock.patch('zun.common.policy.enforce')