class LXDSetupGUIFinishTestCase(unittest.TestCase): def setUp(self): self.controller = LXDSetupController() self.controllers_patcher = patch( 'conjureup.controllers.lxdsetup.gui.controllers') self.mock_controllers = self.controllers_patcher.start() self.utils_patcher = patch('conjureup.controllers.lxdsetup.gui.utils') self.mock_utils = self.utils_patcher.start() self.render_patcher = patch( 'conjureup.controllers.lxdsetup.gui.LXDSetupController.render') self.mock_render = self.render_patcher.start() self.app_patcher = patch('conjureup.controllers.lxdsetup.gui.app') self.mock_app = self.app_patcher.start() self.mock_app.ui = MagicMock(name="app.ui") self.ev_app_patcher = patch('conjureup.events.app', self.mock_app) self.ev_app_patcher.start() events.Shutdown.clear() def tearDown(self): self.controllers_patcher.stop() self.utils_patcher.stop() self.render_patcher.stop() self.app_patcher.stop() self.ev_app_patcher.stop() def test_finish(self): "call finish" with self.assertRaises(Exception): self.controller.finish() assert not events.Shutdown.is_set() self.controller.finish(True) assert events.Shutdown.is_set()
class LXDSetupGUIFinishTestCase(unittest.TestCase): def setUp(self): self.controller = LXDSetupController() self.controllers_patcher = patch( 'conjureup.controllers.lxdsetup.gui.controllers') self.mock_controllers = self.controllers_patcher.start() self.utils_patcher = patch( 'conjureup.controllers.lxdsetup.gui.utils') self.mock_utils = self.utils_patcher.start() self.render_patcher = patch( 'conjureup.controllers.lxdsetup.gui.LXDSetupController.render') self.mock_render = self.render_patcher.start() self.app_patcher = patch( 'conjureup.controllers.lxdsetup.gui.app') self.mock_app = self.app_patcher.start() self.mock_app.ui = MagicMock(name="app.ui") def tearDown(self): self.controllers_patcher.stop() self.utils_patcher.stop() self.render_patcher.stop() self.app_patcher.stop() def test_finish(self): "call finish" self.controller.finish()