def test_create_no_ip_mixin(self, m): test_networks = fakes.networks[fakes.tenants["foo"]["id"]] for test_net in test_networks: parameters = {"occi.core.title": test_net["name"], "org.openstack.network.ip_version": 4, "occi.network.address": "0.0.0.0", } categories = {occi_network.NetworkResource.kind} req = fakes.create_req_test_occi(parameters, categories) fake_net = fakes.fake_build_net( parameters['occi.core.title'], parameters['org.openstack.network.ip_version'], parameters['occi.network.address'] ) m.return_value = fake_net self.assertRaises(exception.OCCIMissingType, self.controller.create, req)
def test_create_no_ip_mixin(self, m): test_networks = fakes.networks[fakes.tenants["foo"]["id"]] for test_net in test_networks: parameters = { "occi.core.title": test_net["name"], "org.openstack.network.ip_version": 4, "occi.network.address": "0.0.0.0", } categories = {occi_network.NetworkResource.kind} req = fakes.create_req_test_occi(parameters, categories) fake_net = fakes.fake_build_net( parameters['occi.core.title'], parameters['org.openstack.network.ip_version'], parameters['occi.network.address']) m.return_value = fake_net self.assertRaises(exception.OCCIMissingType, self.controller.create, req)
def test_create(self, m): test_networks = fakes.networks[fakes.tenants["foo"]["id"]] for test_net in test_networks: parameters = {"occi.core.title": test_net["name"], "org.openstack.network.ip_version": 4, "occi.network.address": "0.0.0.0", } categories = {occi_network.NetworkResource.kind, occi_network.ip_network} req = fakes.create_req_test_occi(parameters, categories) fake_net = fakes.fake_build_net( parameters['occi.core.title'], parameters['org.openstack.network.ip_version'], parameters['occi.network.address'] ) m.return_value = fake_net ret = self.controller.create(req) net = ret.resources.pop() self.assertIsInstance(net, occi_network.NetworkResource) self.assertEqual(net.title, test_net['name'])