Drop sudo requirement from a unit test
I noticed while working on some other stuff that a unit test was prompting me for my sudo password. I narrowed it down to the offending test case and fixed it by mocking out the execute util, as is done in several other places in these tests. Change-Id: I93c6cdb8a26d3be5df5386091dc70a240ab7c190 Closes-bug: #1396276
This commit is contained in:
parent
575b3fe84c
commit
c8298b6f98
|
@ -565,10 +565,12 @@ class TestOvsNeutronAgent(base.BaseTestCase):
|
|||
# Raise a timeout every time until we give up, currently 5 tries
|
||||
self._setup_for_dvr_test()
|
||||
self.agent.dvr_agent.dvr_mac_address = None
|
||||
with mock.patch.object(self.agent.dvr_agent.plugin_rpc,
|
||||
'get_dvr_mac_address_by_host',
|
||||
side_effect=raise_timeout):
|
||||
|
||||
with contextlib.nested(
|
||||
mock.patch.object(self.agent.dvr_agent.plugin_rpc,
|
||||
'get_dvr_mac_address_by_host',
|
||||
side_effect=raise_timeout),
|
||||
mock.patch.object(utils, "execute"),
|
||||
) as (rpc_mock, execute_mock):
|
||||
self.agent.dvr_agent.get_dvr_mac_address()
|
||||
self.assertIsNone(self.agent.dvr_agent.dvr_mac_address)
|
||||
self.assertFalse(self.agent.dvr_agent.in_distributed_mode())
|
||||
|
|
Loading…
Reference in New Issue