Example #1
0
    def test_ensure_rename_handle_removes_and_re_adds_the_new_workspace_name(self, _):
        presenter = PeaksViewerCollectionPresenter(MagicMock())
        presenter.workspace_names = MagicMock(return_value=["ws"])

        def remove_peaks(ws_name):
            presenter.workspace_names().remove(ws_name)
            return 7
        presenter.remove_peaksworkspace = MagicMock(side_effect=remove_peaks)
        presenter.overlay_peaksworkspaces = MagicMock()

        presenter.rename_handle("ws", "ws1")

        presenter.remove_peaksworkspace.assert_called_once_with("ws")
        presenter.overlay_peaksworkspaces.assert_called_once_with(["ws1"], index=7)
Example #2
0
    def test_ensure_that_the_ads_observer_calls_rename_handle(self, _):
        presenter = PeaksViewerCollectionPresenter(MagicMock())
        presenter.rename_handle = MagicMock()
        self.assertTrue(isinstance(presenter._ads_observer, SliceViewerADSObserver))
        presenter._ads_observer = SliceViewerADSObserver(presenter.replace_handle, presenter.rename_handle,
                                                         presenter.clear_handle, presenter.delete_handle)

        CreateSampleWorkspace(OutputWorkspace="ws")
        RenameWorkspace(InputWorkspace="ws", OutputWorkspace="ws1")

        presenter.rename_handle.assert_called_once_with("ws", "ws1")