

@mock.patch.object(glance.api, 'glance')
def test_namespace_get_list_kwargs_and_filters(self, gc):
    kwargs = {
        'sort_dir': 'desc',
        'sort_key': 'namespace',
        'marker': 1,
        'paginate': False,
    }
    filters = {
        'resource_types': 'type',
    }
    request = self.mock_rest_request(**{
        'GET': dict(kwargs, **filters),
    })
    gc.metadefs_namespace_full_list.return_value = ([{
        'namespace': '1',
    }, {
        'namespace': '2',
    }], False, False)
    response = glance.MetadefsNamespaces().get(request)
    self.assertStatusCode(response, 200)
    self.assertEqual(response.json, {
        'items': [{
            'namespace': '1',
        }, {
            'namespace': '2',
        }],
        'has_more_data': False,
        'has_prev_data': False,
    })
    gc.metadefs_namespace_full_list.assert_called_once_with(request, filters=filters, **kwargs)

dataset/ETHPy150Open openstack/horizon/openstack_dashboard/test/api_tests/glance_rest_tests.py ImagesRestTestCase.test_namespace_get_list_kwargs_and_filters/original