code
stringlengths
3
6.57k
self.api.get(_get_path('networks')
self._get_collection_kwargs(limit=1000)
instance.get_networks.assert_called_once_with(mock.ANY, **kwargs)
test_limit_with_negative_value(self)
cfg.CONF.set_default('pagination_max_limit', '1000')
self.api.get(_get_path('networks')
self.assertEqual(exc.HTTPBadRequest.code, res.status_int)
test_limit_with_non_integer(self)
self.api.get(_get_path('networks')
self.assertEqual(exc.HTTPBadRequest.code, res.status_int)
self.assertIn('abc', res)
test_limit_with_infinite_pagination_max_limit(self)
cfg.CONF.set_override('pagination_max_limit', 'Infinite')
self.api.get(_get_path('networks')
self._get_collection_kwargs(limit=None)
instance.get_networks.assert_called_once_with(mock.ANY, **kwargs)
test_limit_with_negative_pagination_max_limit(self)
cfg.CONF.set_default('pagination_max_limit', '-1')
self.api.get(_get_path('networks')
self._get_collection_kwargs(limit=None)
instance.get_networks.assert_called_once_with(mock.ANY, **kwargs)
test_limit_with_non_integer_pagination_max_limit(self)
cfg.CONF.set_default('pagination_max_limit', 'abc')
self.api.get(_get_path('networks')
self._get_collection_kwargs(limit=None)
instance.get_networks.assert_called_once_with(mock.ANY, **kwargs)
test_marker(self)
cfg.CONF.set_override('pagination_max_limit', '1000')
_uuid()
self.api.get(_get_path('networks')
self._get_collection_kwargs(limit=1000, marker=marker)
instance.get_networks.assert_called_once_with(mock.ANY, **kwargs)
test_page_reverse(self)
self.api.get(_get_path('networks')
self._get_collection_kwargs(page_reverse=True)
calls.append(mock.call.get_networks(mock.ANY, **kwargs)
instance.get_networks.assert_called_once_with(mock.ANY, **kwargs)
instance.get_networks.reset_mock()
self.api.get(_get_path('networks')
self._get_collection_kwargs(page_reverse=False)
calls.append(mock.call.get_networks(mock.ANY, **kwargs)
instance.get_networks.assert_called_once_with(mock.ANY, **kwargs)
test_page_reverse_with_non_bool(self)
self.api.get(_get_path('networks')
self._get_collection_kwargs(page_reverse=False)
instance.get_networks.assert_called_once_with(mock.ANY, **kwargs)
test_page_reverse_with_unspecific(self)
self.api.get(_get_path('networks')
self._get_collection_kwargs(page_reverse=False)
instance.get_networks.assert_called_once_with(mock.ANY, **kwargs)
test_sort(self)
self.api.get(_get_path('networks')
self._get_collection_kwargs(sorts=[('name', False)
instance.get_networks.assert_called_once_with(mock.ANY, **kwargs)
test_sort_with_primary_key(self)
self.api.get(_get_path('networks')
self._get_collection_kwargs(sorts=[('name', False)
instance.get_networks.assert_called_once_with(mock.ANY, **kwargs)
test_sort_without_direction(self)
self.api.get(_get_path('networks')
self.assertEqual(exc.HTTPBadRequest.code, res.status_int)
test_sort_with_invalid_attribute(self)
self.api.get(_get_path('networks')
self.assertEqual(exc.HTTPBadRequest.code, res.status_int)
test_sort_with_invalid_dirs(self)
self.api.get(_get_path('networks')
self.assertEqual(exc.HTTPBadRequest.code, res.status_int)
test_emulated_sort(self)
webtest.TestApp(router.APIRouter()
api.get(_get_path('networks')
instance.get_networks.assert_called_once_with(mock.ANY, **kwargs)
test_emulated_sort_without_sort_field(self)
webtest.TestApp(router.APIRouter()
api.get(_get_path('networks')
instance.get_networks.assert_called_once_with(mock.ANY, **kwargs)
test_emulated_pagination(self)
webtest.TestApp(router.APIRouter()
api.get(_get_path('networks')
instance.get_networks.assert_called_once_with(mock.ANY, **kwargs)
test_native_pagination_without_native_sorting(self)
self.assertRaises(n_exc.Invalid, router.APIRouter)
JSONV2TestCase(APIv2TestBase, testlib_api.WebTestCase)
_test_list(self, req_tenant_id, real_tenant_id)
context.Context('', req_tenant_id)
uuidutils.generate_uuid()
self.deserialize(res)
self.assertIn('networks', res)
self.assertEqual(1, len(res['networks'])
self.assertEqual(len(input_dict)
len(output_dict)
input_dict.items()
self.assertEqual(v, output_dict[k])
self.assertEqual(0, len(res['networks'])
test_list_noauth(self)
self._test_list(None, _uuid()
test_list_keystone(self)
_uuid()
self._test_list(tenant_id, tenant_id)
test_list_keystone_bad(self)
_uuid()