def test_dhcp_agent_main(self): with mock.patch("quantum.agent.dhcp_agent.DeviceManager") as dev_mgr: with mock.patch("quantum.agent.dhcp_agent.DhcpAgent") as dhcp: with mock.patch("quantum.agent.dhcp_agent.sys") as mock_sys: mock_sys.argv = [] dhcp_agent.main() dev_mgr.assert_called_once(mock.ANY, "sudo") dhcp.assert_has_calls([mock.call(mock.ANY), mock.call().run()])
def test_dhcp_agent_main(): with mock.patch('quantum.agent.dhcp_agent.DeviceManager') as dev_mgr: with mock.patch('quantum.agent.dhcp_agent.DhcpAgent') as dhcp: dhcp_agent.main() dev_mgr.assert_called_once(mock.ANY, 'sudo') dhcp.assert_has_calls([ mock.call(mock.ANY), mock.call().daemon_loop()])
def test_dhcp_agent_main(self): with mock.patch('quantum.agent.dhcp_agent.DeviceManager') as dev_mgr: with mock.patch('quantum.agent.dhcp_agent.DhcpAgent') as dhcp: with mock.patch('quantum.agent.dhcp_agent.sys') as mock_sys: mock_sys.argv = [] dhcp_agent.main() dev_mgr.assert_called_once(mock.ANY, 'sudo') dhcp.assert_has_calls( [mock.call(mock.ANY), mock.call().run()])
def test_dhcp_agent_main_agent_manager(self): logging_str = 'quantum.agent.common.config.setup_logging' launcher_str = 'quantum.openstack.common.service.ServiceLauncher' with mock.patch(logging_str): with mock.patch.object(sys, 'argv') as sys_argv: with mock.patch(launcher_str) as launcher: sys_argv.return_value = ['dhcp', '--config-file', etcdir('quantum.conf.test')] dhcp_agent.main() launcher.assert_has_calls( [mock.call(), mock.call().launch_service(mock.ANY), mock.call().wait()])
def test_dhcp_agent_main(self): logging_str = 'quantum.agent.common.config.setup_logging' manager_str = 'quantum.agent.dhcp_agent.DeviceManager' agent_str = 'quantum.agent.dhcp_agent.DhcpAgent' with mock.patch(logging_str): with mock.patch(manager_str) as dev_mgr: with mock.patch(agent_str) as dhcp: with mock.patch.object(sys, 'argv') as sys_argv: sys_argv.return_value = ['dhcp', '--config-file', etcdir('quantum.conf.test')] dhcp_agent.main() dev_mgr.assert_called_once(mock.ANY, 'sudo') dhcp.assert_has_calls([ mock.call(mock.ANY), mock.call().run()])
def test_dhcp_agent_main(self): logging_str = 'quantum.agent.common.config.setup_logging' manager_str = 'quantum.agent.dhcp_agent.DeviceManager' agent_str = 'quantum.agent.dhcp_agent.DhcpAgent' agent_sys_str = 'quantum.agent.dhcp_agent.sys' with mock.patch(logging_str): with mock.patch(manager_str) as dev_mgr: with mock.patch(agent_str) as dhcp: with mock.patch(agent_sys_str) as mock_sys: mock_sys.argv = [] dhcp_agent.main() dev_mgr.assert_called_once(mock.ANY, 'sudo') dhcp.assert_has_calls([ mock.call(mock.ANY), mock.call().run()])
def test_dhcp_agent_main(self): logging_str = 'quantum.agent.common.config.setup_logging' manager_str = 'quantum.agent.dhcp_agent.DeviceManager' agent_str = 'quantum.agent.dhcp_agent.DhcpAgent' agent_sys_str = 'quantum.agent.dhcp_agent.sys' with mock.patch(logging_str): with mock.patch(manager_str) as dev_mgr: with mock.patch(agent_str) as dhcp: with mock.patch(agent_sys_str) as mock_sys: mock_sys.argv = [] dhcp_agent.main() dev_mgr.assert_called_once(mock.ANY, 'sudo') dhcp.assert_has_calls( [mock.call(mock.ANY), mock.call().run()])