diff --git a/lib/galaxy/managers/history_contents.py b/lib/galaxy/managers/history_contents.py index cca7fa8589f..7de47a459d9 100644 --- a/lib/galaxy/managers/history_contents.py +++ b/lib/galaxy/managers/history_contents.py @@ -531,9 +531,11 @@ class HistoryContentsFilters( def parse_query_filters_with_relations(self, query_filters: ValueFilterQueryParams, history_id): """Parse query filters but consider case where related filter is included.""" - has_related_q = [q for q in ('related-eq', 'related') if query_filters.q and q in query_filters.q] + has_related_q = [q for q in ("related-eq", "related") if query_filters.q and q in query_filters.q] if has_related_q: - query_filters_with_relations = self.get_query_filters_with_relations(query_filters=query_filters, related_q=has_related_q[0], history_id=history_id) + query_filters_with_relations = self.get_query_filters_with_relations( + query_filters=query_filters, related_q=has_related_q[0], history_id=history_id + ) return super().parse_query_filters(query_filters_with_relations) return super().parse_query_filters(query_filters) diff --git a/lib/galaxy_test/api/test_history_contents.py b/lib/galaxy_test/api/test_history_contents.py index a6ac0053d3e..8f5cc22883b 100644 --- a/lib/galaxy_test/api/test_history_contents.py +++ b/lib/galaxy_test/api/test_history_contents.py @@ -742,7 +742,6 @@ class TestHistoryContentsApi(ApiTestCase): # initialise history with 2 datasets input_hda_id = self.dataset_populator.new_dataset(history_id)["id"] unrelated_hid = self.dataset_populator.new_dataset(history_id)["hid"] - self.dataset_populator.wait_for_history_jobs(history_id) # Run tool on first dataset to get 3rd, related dataset inputs = { @@ -754,26 +753,19 @@ class TestHistoryContentsApi(ApiTestCase): inputs, history_id, ) - self.dataset_populator.wait_for_history_jobs(history_id) related_hid = run_response.json()["outputs"][0]["hid"] # Test q = related-eq, for related items - contents_response = self._get( - f"histories/{history_id}/contents?v=dev&q=related-eq&qv={related_hid}" - ).json() + contents_response = self._get(f"histories/{history_id}/contents?v=dev&q=related-eq&qv={related_hid}").json() assert len(contents_response) == 2 # Test q = related, for unrelated item - contents_response = self._get( - f"histories/{history_id}/contents?v=dev&q=related&qv={unrelated_hid}" - ).json() + contents_response = self._get(f"histories/{history_id}/contents?v=dev&q=related&qv={unrelated_hid}").json() assert len(contents_response) == 1 # Test error case: qv is string - related_hid = "one" - contents_response = self._get( - f"histories/{history_id}/contents?v=dev&q=related-eq&qv={related_hid}" - ) + related_qv = "one" + contents_response = self._get(f"histories/{history_id}/contents?v=dev&q=related-eq&qv={related_qv}") assert contents_response.status_code == 400 assert contents_response.json()["err_msg"] == "unparsable value for related filter"