Merge "Enhance unittest for hyperv_neutron_agent"

This commit is contained in:
Jenkins 2013-09-09 15:24:41 +00:00 committed by Gerrit Code Review
commit 56aca213a6

View File

@ -111,3 +111,19 @@ class TestHyperVNeutronAgent(base.BaseTestCase):
def test_treat_devices_removed_ignores_missing_port(self):
self.mock_treat_devices_removed(False)
def test_main(self):
with mock.patch.object(hyperv_neutron_agent,
'HyperVNeutronAgent') as plugin:
with mock.patch.object(hyperv_neutron_agent, 'cfg') as cfg:
with mock.patch('eventlet.monkey_patch') as eventlet:
with mock.patch.object(
hyperv_neutron_agent,
'logging_config') as logging_config:
hyperv_neutron_agent.main()
self.assertTrue(cfg.called)
self.assertTrue(eventlet.called)
self.assertTrue(logging_config.setup_logging.called)
plugin.assert_has_calls([mock.call().daemon_loop()])