diff --git a/test/unit/managers/test_markdown_export.py b/test/unit/managers/test_markdown_export.py index 16b49ed89f8..a1b475d7dc7 100644 --- a/test/unit/managers/test_markdown_export.py +++ b/test/unit/managers/test_markdown_export.py @@ -22,6 +22,12 @@ class BaseExportTestCase(BaseTestCase): self.app.history_manager = mock.MagicMock() self.app.dataset_collections_service = mock.MagicMock() + def _new_history(self): + history = model.History() + history.id = 1 + history.name = "New History" + return history + def _new_hda(self, contents=None): hda = model.HistoryDatasetAssociation() hda.id = 1 @@ -39,6 +45,12 @@ class BaseExportTestCase(BaseTestCase): invocation.create_time = now() return invocation + @contextmanager + def _expect_get_history(self, history): + self.app.history_manager.get_accessible.return_value = history + yield + self.app.history_manager.get_accessible.assert_called_once_with(history.id, self.trans.user) + @contextmanager def _expect_get_hda(self, hda, hda_id=1): self.app.hda_manager.get_accessible.return_value = hda @@ -128,6 +140,17 @@ history_dataset_peek(history_dataset_id=1) result = self._to_basic(example) assert '\n*No Dataset Peek Available*\n' in result + def test_history_link(self): + history = self._new_history() + example = """# Example +```galaxy +history_link(history_id=1) +``` +""" + with self._expect_get_history(history): + result = self._to_basic(example) + assert '\n New History\n\n' in result + def test_history_display_binary(self): hda = self._new_hda() hda.extension = 'ab1'