diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-02-08 01:43:58 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-02-08 01:43:58 +0000 |
| commit | 9d8bc93fe0af5250097ca5fb1002c86df9809b3c (patch) | |
| tree | 9b4d8e39cc3e825b2117b1088f8b5f6dff43178c /nova/tests | |
| parent | aa333c7a7cba7f26eb95735ff2eeeefe9f213608 (diff) | |
| parent | 12fa59dbb2a96d8f07d6247a08709222b359d87a (diff) | |
Merge "Move floating ip db access to calling side."
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/api/openstack/compute/contrib/test_floating_ips.py | 13 | ||||
| -rw-r--r-- | nova/tests/conf_fixture.py | 4 | ||||
| -rw-r--r-- | nova/tests/network/test_api.py | 7 |
3 files changed, 13 insertions, 11 deletions
diff --git a/nova/tests/api/openstack/compute/contrib/test_floating_ips.py b/nova/tests/api/openstack/compute/contrib/test_floating_ips.py index b6b8dd630..864ab7a9f 100644 --- a/nova/tests/api/openstack/compute/contrib/test_floating_ips.py +++ b/nova/tests/api/openstack/compute/contrib/test_floating_ips.py @@ -27,7 +27,6 @@ from nova import db from nova import exception from nova import network from nova.openstack.common import jsonutils -from nova.openstack.common import rpc from nova import test from nova.tests.api.openstack import fakes from nova.tests import fake_network @@ -275,12 +274,11 @@ class FloatingIpTest(test.TestCase): self.assertIn(self.floating_ip, ip_list) self.assertNotIn(self.floating_ip_2, ip_list) -# test floating ip allocate/release(deallocate) def test_floating_ip_allocate_no_free_ips(self): - def fake_call(*args, **kwargs): + def fake_allocate(*args, **kwargs): raise exception.NoMoreFloatingIps() - self.stubs.Set(rpc, "call", fake_call) + self.stubs.Set(network.api.API, "allocate_floating_ip", fake_allocate) req = fakes.HTTPRequest.blank('/v2/fake/os-floating-ips') self.assertRaises(exception.NoMoreFloatingIps, @@ -316,9 +314,12 @@ class FloatingIpTest(test.TestCase): req = fakes.HTTPRequest.blank('/v2/fake/os-floating-ips/1') self.controller.delete(req, 1) -# test floating ip add/remove -> associate/disassociate - def test_floating_ip_associate(self): + def fake_associate_floating_ip(*args, **kwargs): + pass + + self.stubs.Set(network.api.API, "associate_floating_ip", + fake_associate_floating_ip) body = dict(addFloatingIp=dict(address=self.floating_ip)) req = fakes.HTTPRequest.blank('/v2/fake/servers/test_inst/action') diff --git a/nova/tests/conf_fixture.py b/nova/tests/conf_fixture.py index 2f4d0ebb1..230f70a1b 100644 --- a/nova/tests/conf_fixture.py +++ b/nova/tests/conf_fixture.py @@ -30,8 +30,8 @@ CONF.import_opt('scheduler_driver', 'nova.scheduler.manager') CONF.import_opt('fake_network', 'nova.network.manager') CONF.import_opt('network_size', 'nova.network.manager') CONF.import_opt('num_networks', 'nova.network.manager') -CONF.import_opt('floating_ip_dns_manager', 'nova.network.manager') -CONF.import_opt('instance_dns_manager', 'nova.network.manager') +CONF.import_opt('floating_ip_dns_manager', 'nova.network.floating_ips') +CONF.import_opt('instance_dns_manager', 'nova.network.floating_ips') CONF.import_opt('policy_file', 'nova.policy') CONF.import_opt('compute_driver', 'nova.virt.driver') CONF.import_opt('api_paste_config', 'nova.wsgi') diff --git a/nova/tests/network/test_api.py b/nova/tests/network/test_api.py index 8e9abe1db..01c727c17 100644 --- a/nova/tests/network/test_api.py +++ b/nova/tests/network/test_api.py @@ -26,8 +26,8 @@ from nova import context from nova import exception from nova import network from nova.network import api +from nova.network import floating_ips from nova.network import rpcapi as network_rpcapi -from nova.openstack.common import rpc from nova import policy from nova import test @@ -90,10 +90,11 @@ class ApiTestCase(test.TestCase): new_instance = {'uuid': 'new-uuid'} - def fake_rpc_call(context, topic, msg, timeout=None): + def fake_associate(*args, **kwargs): return orig_instance_uuid - self.stubs.Set(rpc, 'call', fake_rpc_call) + self.stubs.Set(floating_ips.FloatingIP, 'associate_floating_ip', + fake_associate) def fake_instance_get_by_uuid(context, instance_uuid): return {'uuid': instance_uuid} |
