]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fixing the bug in FakePlugin
authorSalvatore Orlando <salvatore.orlando@eu.citrix.com>
Mon, 5 Sep 2011 17:18:46 +0000 (18:18 +0100)
committerSalvatore Orlando <salvatore.orlando@eu.citrix.com>
Mon, 5 Sep 2011 17:18:46 +0000 (18:18 +0100)
quantum/plugins/SamplePlugin.py
tests/unit/test_api.py

index af75083daa000775b53b0f91706a9f91a7be795a..c45a76616f0a4221c4f7b9f31146b51230a11021 100644 (file)
@@ -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:
index 70af451d31f321a34488eb188b2624ce63b09a66..a0907d1e3d0fd0c1ec0de6f76a026966022fb800 100644 (file)
@@ -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')