]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Make MockFixedIntervalLoopingCall class as a helper class
authorAman Kumar <amank@hp.com>
Wed, 3 Jun 2015 06:49:40 +0000 (23:49 -0700)
committerAman Kumar <amank@hp.com>
Wed, 3 Jun 2015 07:02:56 +0000 (07:02 +0000)
MockFixedIntervalLoopingCall class is used in both the classes
TestOvsNeutronAgent and TestOvsDvrNeutronAgent.

This patch removes the MockFixedIntervalLoopingCall from both the
places and make it as a helper class in test_ovs_neutron_agent.py.
So that it will be used everywhere in test_ovs_neutron_agent.py.

Change-Id: I5e0803436e91b4f20ec03209e9e799a68df4eaf4

neutron/tests/unit/plugins/openvswitch/agent/test_ovs_neutron_agent.py

index d8cd5a8c644151436d0a2246c20cd40d9a70526b..8851f794b289103a59be479ee513f6d3bcbe9824 100644 (file)
@@ -45,6 +45,14 @@ class FakeVif(object):
     port_name = 'name'
 
 
+class MockFixedIntervalLoopingCall(object):
+    def __init__(self, f):
+        self.f = f
+
+    def start(self, interval=0):
+        self.f()
+
+
 class CreateAgentConfigMap(ovs_test_base.OVSAgentConfigTestBase):
 
     def test_create_agent_config_map_succeeds(self):
@@ -106,13 +114,6 @@ class TestOvsNeutronAgent(object):
         cfg.CONF.set_default('prevent_arp_spoofing', False, 'AGENT')
         kwargs = self.mod_agent.create_agent_config_map(cfg.CONF)
 
-        class MockFixedIntervalLoopingCall(object):
-            def __init__(self, f):
-                self.f = f
-
-            def start(self, interval=0):
-                self.f()
-
         with mock.patch.object(self.mod_agent.OVSNeutronAgent,
                                'setup_integration_br'),\
                 mock.patch.object(self.mod_agent.OVSNeutronAgent,
@@ -1229,13 +1230,6 @@ class TestOvsDvrNeutronAgent(object):
                              group='SECURITYGROUP')
         kwargs = self.mod_agent.create_agent_config_map(cfg.CONF)
 
-        class MockFixedIntervalLoopingCall(object):
-            def __init__(self, f):
-                self.f = f
-
-            def start(self, interval=0):
-                self.f()
-
         with mock.patch.object(self.mod_agent.OVSNeutronAgent,
                                'setup_integration_br'),\
                 mock.patch.object(self.mod_agent.OVSNeutronAgent,