Merge "Expose container filters via API"
This commit is contained in:
commit
c8bb125fc5
@ -124,7 +124,14 @@ class ContainersController(base.Controller):
|
||||
resource_url = kwargs.get('resource_url')
|
||||
expand = kwargs.get('expand')
|
||||
|
||||
filters = None
|
||||
container_allowed_filters = ['name', 'image', 'project_id', 'user_id',
|
||||
'memory', 'host', 'task_state', 'status',
|
||||
'auto_remove']
|
||||
filters = {}
|
||||
for filter_key in container_allowed_filters:
|
||||
if filter_key in kwargs:
|
||||
filter_value = kwargs[filter_key]
|
||||
filters[filter_key] = filter_value
|
||||
marker_obj = None
|
||||
marker = kwargs.get('marker')
|
||||
if marker:
|
||||
|
@ -802,7 +802,7 @@ class TestContainerController(api_base.FunctionalTest):
|
||||
|
||||
mock_container_list.assert_called_once_with(mock.ANY,
|
||||
1000, None, 'id', 'asc',
|
||||
filters=None)
|
||||
filters={})
|
||||
context = mock_container_list.call_args[0][0]
|
||||
self.assertIs(False, context.all_projects)
|
||||
self.assertEqual(200, response.status_int)
|
||||
@ -826,7 +826,7 @@ class TestContainerController(api_base.FunctionalTest):
|
||||
|
||||
mock_container_list.assert_called_once_with(mock.ANY,
|
||||
1000, None, 'id', 'asc',
|
||||
filters=None)
|
||||
filters={})
|
||||
context = mock_container_list.call_args[0][0]
|
||||
self.assertIs(True, context.all_projects)
|
||||
self.assertEqual(200, response.status_int)
|
||||
@ -884,7 +884,7 @@ class TestContainerController(api_base.FunctionalTest):
|
||||
response = self.get('/v1/containers/')
|
||||
mock_container_list.assert_called_once_with(mock.ANY,
|
||||
1000, None, 'id', 'asc',
|
||||
filters=None)
|
||||
filters={})
|
||||
self.assertEqual(200, response.status_int)
|
||||
actual_containers = response.json['containers']
|
||||
self.assertEqual(1, len(actual_containers))
|
||||
|
Loading…
Reference in New Issue
Block a user