diff options
| author | Chris Yeoh <cyeoh@au1.ibm.com> | 2013-05-08 12:33:29 +0930 |
|---|---|---|
| committer | Chris Yeoh <cyeoh@au1.ibm.com> | 2013-05-08 12:33:29 +0930 |
| commit | 6cfc02531f92c2e98eb947bc7a46d6bed0158d82 (patch) | |
| tree | 643b56f133adeff3b37d70c00c8c99c72f14de70 /nova/tests | |
| parent | e02c365888d046179b4326a1e6d85602f56ec032 (diff) | |
Fixes KeyError bug with network api associate
Fixes bug in network api associate function where it would always
raise a KeyError when associating or disassociating a project.
Fixes bug 1171284
Change-Id: Iae0e57e0a961b8a3377b38dad72094188755a3e8
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/network/test_api.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/nova/tests/network/test_api.py b/nova/tests/network/test_api.py index 304229b20..76ace8b02 100644 --- a/nova/tests/network/test_api.py +++ b/nova/tests/network/test_api.py @@ -255,3 +255,19 @@ class ApiTestCase(test.TestCase): instance = {'uuid': FAKE_UUID} result = self.network_api._is_multi_host(self.context, instance) self.assertEqual(is_multi_host, result) + + def test_network_disassociate_project(self): + def fake_network_disassociate(ctx, network_id, disassociate_host, + disassociate_project): + self.assertEqual(network_id, 1) + self.assertEqual(disassociate_host, False) + self.assertEqual(disassociate_project, True) + + def fake_get(context, network_uuid): + return {'id': 1} + + self.stubs.Set(self.network_api.db, 'network_disassociate', + fake_network_disassociate) + self.stubs.Set(self.network_api, 'get', fake_get) + + self.network_api.associate(self.context, FAKE_UUID, project=None) |
