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
This commit is contained in:
Aman Kumar 2015-06-02 23:49:40 -07:00
parent 9e3fe1fe57
commit 608c282285
1 changed files with 8 additions and 14 deletions

View 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,