]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
linuxbridge UT: Do not create the same instance in each cases
authorYAMAMOTO Takashi <yamamoto@valinux.co.jp>
Tue, 10 Mar 2015 01:23:53 +0000 (10:23 +0900)
committerYAMAMOTO Takashi <yamamoto@valinux.co.jp>
Tue, 10 Mar 2015 01:27:50 +0000 (10:27 +0900)
Reuse the one created by setUp() instead.

Related-Bug: #1430098
Change-Id: I2cf1123c66a81ad967507a2fefb89c306cdb28bb

neutron/tests/unit/linuxbridge/test_lb_neutron_agent.py

index b32a03cb8d6ef3c376478f6b7a8adaa95dc69dd7..9fb816ec17729c0a38194f8c23c9dba149ea9b5f 100644 (file)
@@ -108,7 +108,7 @@ class TestLinuxBridgeAgent(base.BaseTestCase):
                                                                           0)
 
     def test_treat_devices_removed_with_existed_device(self):
-        agent = linuxbridge_neutron_agent.LinuxBridgeNeutronAgentRPC({}, 0)
+        agent = self.agent
         devices = [DEVICE_1]
         with contextlib.nested(
             mock.patch.object(agent.plugin_rpc, "update_device_down"),
@@ -125,7 +125,7 @@ class TestLinuxBridgeAgent(base.BaseTestCase):
                 self.assertTrue(fn_rdf.called)
 
     def test_treat_devices_removed_with_not_existed_device(self):
-        agent = linuxbridge_neutron_agent.LinuxBridgeNeutronAgentRPC({}, 0)
+        agent = self.agent
         devices = [DEVICE_1]
         with contextlib.nested(
             mock.patch.object(agent.plugin_rpc, "update_device_down"),
@@ -142,7 +142,7 @@ class TestLinuxBridgeAgent(base.BaseTestCase):
                 self.assertTrue(fn_rdf.called)
 
     def test_treat_devices_removed_failed(self):
-        agent = linuxbridge_neutron_agent.LinuxBridgeNeutronAgentRPC({}, 0)
+        agent = self.agent
         devices = [DEVICE_1]
         with contextlib.nested(
             mock.patch.object(agent.plugin_rpc, "update_device_down"),