mock quantum.agent.common.config.setup_logging

Bug #1137249

Change-Id: I7eb7ec3c0247c1ceeefc8e3f88d9cd7753c38c0c
This commit is contained in:
gongysh 2013-03-01 15:36:19 +08:00
parent 3b24fb117b
commit 6bb8b1df88

View File

@ -43,12 +43,14 @@ class TestLbaasService(testtools.TestCase):
self.assertTrue(mock_start.called) self.assertTrue(mock_start.called)
def test_main(self): def test_main(self):
logging_str = 'quantum.agent.common.config.setup_logging'
with contextlib.nested( with contextlib.nested(
mock.patch(logging_str),
mock.patch.object(agent.service, 'launch'), mock.patch.object(agent.service, 'launch'),
mock.patch.object(agent, 'eventlet'), mock.patch.object(agent, 'eventlet'),
mock.patch('sys.argv'), mock.patch('sys.argv'),
mock.patch.object(agent.manager, 'LbaasAgentManager') mock.patch.object(agent.manager, 'LbaasAgentManager')
) as (mock_launch, mock_eventlet, sys_argv, mgr_cls): ) as (mock_logging, mock_launch, mock_eventlet, sys_argv, mgr_cls):
agent.main() agent.main()
self.assertTrue(mock_eventlet.monkey_patch.called) self.assertTrue(mock_eventlet.monkey_patch.called)