示例#1
0
    def test_bad_view_causes_errors_to_be_logged(self):
        class V(object):
            pass

        view = V()
        presenter = BasePresenter(view)

        with LogCapture() as lc:
            presenter.show_error("test message", traceback="logged traceback")

        lc.check(('mantidimaging.gui.mvp_base.presenter', 'ERROR', 'Presenter error: test message\nlogged traceback'))
    def test_default_notify_method_raises_exception(self):
        view = mock.create_autospec(BaseMainWindowView)
        presenter = BasePresenter(view)

        with self.assertRaises(NotImplementedError):
            presenter.notify(0)
    def test_show_error_message_forwarded_to_dialog_view(self):
        view = mock.create_autospec(BaseDialogView)
        presenter = BasePresenter(view)

        presenter.show_error("test message", traceback="")
        view.show_error_dialog.assert_called_once_with("test message")