コード例 #1
0
class BootstrapwaitGUIRenderTestCase(unittest.TestCase):
    def setUp(self):
        self.controller = BootstrapWaitController()

        self.finish_patcher = patch(
            'conjureup.controllers.bootstrapwait.gui.'
            'BootstrapWaitController.finish')
        self.mock_finish = self.finish_patcher.start()

        self.view_patcher = patch(
            'conjureup.controllers.bootstrapwait.gui.BootstrapWaitView')
        self.view_patcher.start()
        self.app_patcher = patch(
            'conjureup.controllers.bootstrapwait.gui.app')
        mock_app = self.app_patcher.start()
        mock_app.ui = MagicMock(name="app.ui")

        self.eventloop_patcher = patch(
            'conjureup.controllers.bootstrapwait.gui.EventLoop')
        self.mock_eventloop = self.eventloop_patcher.start()

    def tearDown(self):
        self.finish_patcher.stop()
        self.view_patcher.stop()
        self.app_patcher.stop()
        self.eventloop_patcher.stop()

    def test_render(self):
        "call render"
        self.controller.render()
コード例 #2
0
class BootstrapwaitGUIRenderTestCase(unittest.TestCase):
    def setUp(self):
        self.controller = BootstrapWaitController()

        self.finish_patcher = patch('conjureup.controllers.bootstrapwait.gui.'
                                    'BootstrapWaitController.finish')
        self.mock_finish = self.finish_patcher.start()

        self.view_patcher = patch(
            'conjureup.controllers.bootstrapwait.gui.BootstrapWaitView')
        self.view_patcher.start()
        self.app_patcher = patch('conjureup.controllers.bootstrapwait.gui.app')
        mock_app = self.app_patcher.start()
        mock_app.ui = MagicMock(name="app.ui")

        self.eventloop_patcher = patch(
            'conjureup.controllers.bootstrapwait.gui.EventLoop')
        self.mock_eventloop = self.eventloop_patcher.start()

    def tearDown(self):
        self.finish_patcher.stop()
        self.view_patcher.stop()
        self.app_patcher.stop()
        self.eventloop_patcher.stop()

    def test_render(self):
        "call render"
        self.controller.render()
コード例 #3
0
class BootstrapwaitGUIRenderTestCase(unittest.TestCase):
    def setUp(self):
        self.controller = BootstrapWaitController()

        self.controller.refresh = MagicMock(return_value=sentinel.refresh)
        self.controller.finish = MagicMock(return_value=sentinel.finish)

        self.finish_patcher = patch('conjureup.controllers.bootstrapwait.gui.'
                                    'BootstrapWaitController.finish')
        self.mock_finish = self.finish_patcher.start()

        self.view_patcher = patch(
            'conjureup.controllers.bootstrapwait.gui.BootstrapWaitView')
        self.view_patcher.start()
        self.app_patcher = patch('conjureup.controllers.bootstrapwait.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()

        self.track_screen_patcher = patch(
            'conjureup.controllers.bootstrapwait.gui.track_screen')
        self.mock_track_screen = self.track_screen_patcher.start()

    def tearDown(self):
        self.finish_patcher.stop()
        self.view_patcher.stop()
        self.app_patcher.stop()
        self.ev_app_patcher.stop()
        self.track_screen_patcher.stop()

    def test_render(self):
        "call render"
        self.controller.render()
        self.assertEqual(self.mock_app.loop.create_task.mock_calls,
                         [call(sentinel.refresh),
                          call(sentinel.finish)])