diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-06-24 12:25:18 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-06-24 12:25:18 +0000 |
| commit | 3cfb2c7f51967c850fd4fc93a84a7943d32459b8 (patch) | |
| tree | 3ba00f15545b827ce69a92d35c84f007769abcae | |
| parent | cefb0510b8f12dab17126907661d82094c31741d (diff) | |
| parent | 14d3ae58c1ec39edd1b0b2a2a1947c5f8e96bab5 (diff) | |
| download | nova-3cfb2c7f51967c850fd4fc93a84a7943d32459b8.tar.gz nova-3cfb2c7f51967c850fd4fc93a84a7943d32459b8.tar.xz nova-3cfb2c7f51967c850fd4fc93a84a7943d32459b8.zip | |
Merge "Quantumapi returns an empty network list"
| -rw-r--r-- | nova/network/quantumv2/api.py | 2 | ||||
| -rw-r--r-- | nova/tests/network/test_quantumv2.py | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/nova/network/quantumv2/api.py b/nova/network/quantumv2/api.py index e155f694a..c7f4ffd58 100644 --- a/nova/network/quantumv2/api.py +++ b/nova/network/quantumv2/api.py @@ -538,7 +538,7 @@ class API(base.Base): def get_all(self, context): """Get all networks for client.""" client = quantumv2.get_client(context) - networks = client.list_networks().get('networks') or {} + networks = client.list_networks().get('networks') for network in networks: network['label'] = network['name'] return networks diff --git a/nova/tests/network/test_quantumv2.py b/nova/tests/network/test_quantumv2.py index 7f21a2aa9..d97dcae57 100644 --- a/nova/tests/network/test_quantumv2.py +++ b/nova/tests/network/test_quantumv2.py @@ -1357,6 +1357,13 @@ class TestQuantumv2(test.TestCase): self.assertEqual(nw_info[0]['type'], model.VIF_TYPE_BRIDGE) self.assertEqual(nw_info[0]['network']['bridge'], 'brqnet-id') + def test_get_all_empty_list_networks(self): + api = quantumapi.API() + self.moxed_client.list_networks().AndReturn({'networks': []}) + self.mox.ReplayAll() + networks = api.get_all(self.context) + self.assertEqual(networks, []) + class TestQuantumv2ModuleMethods(test.TestCase): def test_ensure_requested_network_ordering_no_preference_ids(self): |
