mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Add test coverage for history advanced filters
When dealing with archived histories.
This commit is contained in:
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user