Merge "Fix unnecessary logging messages during tests"

This commit is contained in:
Jenkins 2012-11-06 02:35:42 +00:00 committed by Gerrit Code Review
commit 11229438ff
3 changed files with 21 additions and 15 deletions

View File

@ -6,8 +6,9 @@ from quantum.agent import netns_cleanup_util as util
class TestNetnsCleanup(unittest.TestCase):
def test_setup_conf(self):
conf = util.setup_conf()
self.assertFalse(conf.force)
with mock.patch('quantum.common.config.setup_logging'):
conf = util.setup_conf()
self.assertFalse(conf.force)
def test_kill_dhcp(self, dhcp_active=True):
conf = mock.Mock()

View File

@ -92,15 +92,20 @@ class TestDhcpAgent(unittest.TestCase):
self.driver_cls_p.stop()
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()])
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_run_completes_single_pass(self):
with mock.patch('quantum.agent.dhcp_agent.DeviceManager') as dev_mgr:

View File

@ -305,9 +305,9 @@ class TestBasicRouterOperations(unittest.TestCase):
agent_mock_p = mock.patch('quantum.agent.l3_agent.L3NATAgent')
agent_mock = agent_mock_p.start()
agent_mock.daemon_loop.return_value = None
with mock.patch('quantum.agent.l3_agent.sys') as mock_sys:
mock_sys.argv = []
l3_agent.main()
with mock.patch('quantum.agent.common.config.setup_logging'):
with mock.patch('quantum.agent.l3_agent.sys') as mock_sys:
mock_sys.argv = []
l3_agent.main()
agent_mock_p.stop()