Add test coverage for both types of not-found-ness in neutronclient for floating

This adds coverage for the exceptions.NotFound case when we're getting
floating IPs from neutronclient. It makes the NeutronClientException case
the "legacy" one that we can remove when we fix that bug.

Change-Id: I9c8b20e076527f98085265755a2d2503c703f235
Partial-Bug: 1513879
This commit is contained in:
Dan Smith 2015-11-11 09:13:47 -08:00
parent cbbbaa93ae
commit 69c39b7315
1 changed files with 10 additions and 0 deletions

View File

@ -3583,6 +3583,16 @@ class TestNeutronv2WithMock(test.TestCase):
@mock.patch('nova.network.neutronv2.api.get_client')
def test_get_floating_ips_by_project_not_found(self, mock_ntrn):
mock_nc = mock.Mock()
mock_ntrn.return_value = mock_nc
mock_nc.list_floatingips.side_effect = exceptions.NotFound()
fips = self.api.get_floating_ips_by_project(self.context)
self.assertEqual([], fips)
@mock.patch('nova.network.neutronv2.api.get_client')
def test_get_floating_ips_by_project_not_found_legacy(self, mock_ntrn):
# FIXME(danms): Remove this test along with the code path it tests
# when bug 1513879 is fixed.
mock_nc = mock.Mock()
mock_ntrn.return_value = mock_nc
# neutronclient doesn't raise NotFound in this scenario, it raises a