From: Salvatore Orlando Date: Mon, 5 Sep 2011 17:18:46 +0000 (+0100) Subject: Fixing the bug in FakePlugin X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=32a51c648eb2dcb7e59e95b5bde2cfb7c2d885b1;p=openstack-build%2Fneutron-build.git Fixing the bug in FakePlugin --- diff --git a/quantum/plugins/SamplePlugin.py b/quantum/plugins/SamplePlugin.py index af75083da..c45a76616 100644 --- a/quantum/plugins/SamplePlugin.py +++ b/quantum/plugins/SamplePlugin.py @@ -238,6 +238,7 @@ class FakePlugin(object): specified Virtual Network. """ LOG.debug("FakePlugin.get_all_ports() called") + self._get_network(tenant_id, net_id) port_ids = [] ports = db.port_list(net_id) for x in ports: diff --git a/tests/unit/test_api.py b/tests/unit/test_api.py index 70af451d3..a0907d1e3 100644 --- a/tests/unit/test_api.py +++ b/tests/unit/test_api.py @@ -298,6 +298,14 @@ class APITest(unittest.TestCase): self.assertEqual(len(port_data['ports']), 2) LOG.debug("_test_list_ports - format:%s - END", format) + def _test_list_ports_networknotfound(self, format): + LOG.debug("_test_list_ports_networknotfound - format:%s - START", format) + list_port_req = testlib.port_list_request(self.tenant_id, + "A_BAD_ID", format) + list_port_res = list_port_req.get_response(self.api) + self.assertEqual(list_port_res.status_int, 420) + LOG.debug("_test_list_ports_networknotfound - format:%s - END", format) + def _test_list_ports_detail(self, format): LOG.debug("_test_list_ports_detail - format:%s - START", format) content_type = "application/%s" % format @@ -882,6 +890,12 @@ class APITest(unittest.TestCase): def test_list_ports_xml(self): self._test_list_ports('xml') + def test_list_ports_networknotfound_json(self): + self._test_list_ports_networknotfound('json') + + def test_list_ports_networknotfound_xml(self): + self._test_list_ports_networknotfound('xml') + def test_list_ports_detail_json(self): self._test_list_ports_detail('json')