From 608c282285380704e70228ef549646a61492d2bd Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Tue, 2 Jun 2015 23:49:40 -0700 Subject: [PATCH] Make MockFixedIntervalLoopingCall class as a helper class 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 --- .../agent/test_ovs_neutron_agent.py | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/neutron/tests/unit/plugins/openvswitch/agent/test_ovs_neutron_agent.py b/neutron/tests/unit/plugins/openvswitch/agent/test_ovs_neutron_agent.py index d8cd5a8c6..8851f794b 100644 --- a/neutron/tests/unit/plugins/openvswitch/agent/test_ovs_neutron_agent.py +++ b/neutron/tests/unit/plugins/openvswitch/agent/test_ovs_neutron_agent.py @@ -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, -- 2.45.2