code
stringlengths
3
6.57k
_uuid()
test_get_keystone_shared_network(self)
_uuid()
self._test_get(tenant_id + "another", tenant_id, 200)
test_get_keystone_strip_admin_only_attribute(self)
_uuid()
policy.set_rules(rules, overwrite=False)
self._test_get(tenant_id, tenant_id, 200)
self.deserialize(res)
self.assertNotIn('name', res['network'])
context.Context('', req_tenant_id)
return_value.update(data['network'].copy()
uuidutils.generate_uuid()
self.serialize(data)
self.assertEqual(1, instance.get_network.call_count)
self.assertIn('id', instance.get_network.call_args[1]['fields'])
self.assertEqual(res.status_int, expected_code)
test_update_noauth(self)
self._test_update(None, _uuid()
test_update_keystone(self)
_uuid()
self._test_update(tenant_id, tenant_id, 200)
test_update_keystone_bad_tenant(self)
_uuid()
test_update_keystone_no_tenant(self)
_uuid()
test_update_readonly_field(self)
self.api.put(_get_path('networks', id=_uuid()
self.serialize(data)
self.assertEqual(400, res.status_int)
test_invalid_attribute_field(self)
self.api.put(_get_path('networks', id=_uuid()
self.serialize(data)
self.assertEqual(400, res.status_int)
test_retry_on_index(self)
db_exc.RetryRequest(None)
webtest.TestApp(router.APIRouter()
api.get(_get_path('networks', fmt=self.fmt)
self.assertTrue(instance.get_networks.called)
test_retry_on_show(self)
db_exc.RetryRequest(None)
webtest.TestApp(router.APIRouter()
api.get(_get_path('networks', _uuid()
self.assertTrue(instance.get_network.called)
SubresourceTest(base.BaseTestCase)
setUp(self)
super(SubresourceTest, self)
setUp()
self.skipException('this class will be deleted')
self.useFixture(fixture.APIDefinitionFixture()
self.config_parse()
self.setup_coreplugin(plugin, load_plugins=False)
mock.patch(plugin, autospec=True)
self._plugin_patcher.start()
router.APIRouter()
get('collection_name')
get('parent')
directory.get_plugin()
api.map.collection(collection_name, resource_name, **mapper_kwargs)
webtest.TestApp(api)
test_index_sub_resource(self)
self.api.get('/networks/id1/dummies')
test_show_sub_resource(self)
_uuid()
self.api.get('/networks/id1' + _get_path('dummies', id=dummy_id)
test_create_sub_resource(self)
_uuid()
self.api.post_json('/networks/id1/dummies', body)
test_update_sub_resource(self)
_uuid()
self.api.put_json('/networks/id1' + _get_path('dummies', id=dummy_id)
test_update_subresource_to_none(self)
_uuid()
self.api.put_json('/networks/id1' + _get_path('dummies', id=dummy_id)
test_delete_sub_resource(self)
_uuid()
self.api.delete('/networks/id1' + _get_path('dummies', id=dummy_id)
test_sub_resource_member_actions(self)
_uuid()
V2Views(base.BaseTestCase)
_view(self, keys, collection, resource)
dict((key, 'value')
v2_base.Controller(None, collection, resource, attr_info)
controller._view(context.get_admin_context()
self.assertNotIn('fake', res)
self.assertIn(key, res)
test_network(self)
self._view(keys, 'networks', 'network')
test_port(self)
self._view(keys, 'ports', 'port')
test_subnet(self)
self._view(keys, 'subnets', 'subnet')
NotificationTest(APIv2TestBase)
setUp(self)
super(NotificationTest, self)
setUp()
fake_notifier.reset()
_resource_op_notifier(self, opname, resource, expected_errors=False)
_uuid()
_get_path('networks')