From cd9c84d61a775c94820bfb12ad6a7ccb0dfbeb1f Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Thu, 28 Mar 2024 11:14:25 +0100 Subject: [PATCH] Add test coverage for history advanced filters When dealing with archived histories. --- lib/galaxy_test/api/test_histories.py | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/lib/galaxy_test/api/test_histories.py b/lib/galaxy_test/api/test_histories.py index 7ba1fc7fe93..3963404b6af 100644 --- a/lib/galaxy_test/api/test_histories.py +++ b/lib/galaxy_test/api/test_histories.py @@ -304,6 +304,40 @@ class TestHistoriesApi(ApiTestCase, BaseHistories): index_response = self._get("histories", data=data).json() assert len(index_response) == 1 + archived_history_id = self._create_history(f"Archived history_{uuid4()}")["id"] + name_contains = "history" + data = dict(search=name_contains, show_published=False) + index_response = self._get("histories", data=data).json() + assert len(index_response) == 4 + + # Archived histories should not be included in the index + self.dataset_populator.archive_history(archived_history_id) + data = dict(search=name_contains, show_published=False) + index_response = self._get("histories", data=data).json() + assert len(index_response) == 3 + + archived_public_history_id = self._create_history(f"Public Archived history_{uuid4()}")["id"] + self._update(archived_public_history_id, {"published": True}) + self.dataset_populator.archive_history(archived_public_history_id) + data = dict(search=name_contains, show_published=False) + index_response = self._get("histories", data=data).json() + assert len(index_response) == 3 + + name_contains = "Archived" + data = dict(search=name_contains, show_published=False) + index_response = self._get("histories", data=data).json() + assert len(index_response) == 0 + + # Archived public histories should be included when filtering by published + data = dict(search="is:published") + index_response = self._get("histories", data=data).json() + assert len(index_response) == 2 + + name_contains = "Archived" + data = dict(search=name_contains, show_published=True) + index_response = self._get("histories", data=data).json() + assert len(index_response) == 1 + def test_delete(self): # Setup a history and ensure it is in the index history_id = self._create_history("TestHistoryForDelete")["id"]