From 784200bb49025adf48b02bdb8bea4b5ece3b1e20 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 26 Sep 2023 18:22:57 +0100 Subject: [PATCH 1/2] Don't copy collection elements in ``test_dataset_collection_hide_originals`` Follow-up to https://github.com/galaxyproject/galaxy/pull/16717 . Minimal performance gain but helps document the parameter use after the change in default value to True. --- lib/galaxy_test/api/test_history_contents.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/galaxy_test/api/test_history_contents.py b/lib/galaxy_test/api/test_history_contents.py index 74be58604d08..cf5f76c52d5f 100644 --- a/lib/galaxy_test/api/test_history_contents.py +++ b/lib/galaxy_test/api/test_history_contents.py @@ -495,7 +495,7 @@ def test_jobs_summary_implicit_hdca(self, history_id): def test_dataset_collection_hide_originals(self, history_id): payload = self.dataset_collection_populator.create_pair_payload( - history_id, type="dataset_collection", direct_upload=False + history_id, type="dataset_collection", direct_upload=False, copy_elements=False ) payload["hide_source_items"] = True @@ -503,9 +503,7 @@ def test_dataset_collection_hide_originals(self, history_id): self.__check_create_collection_response(dataset_collection_response) contents_response = self._get(f"histories/{history_id}/contents") - datasets = [ - d for d in contents_response.json() if d["history_content_type"] == "dataset" and d["hid"] in [1, 2] - ] + datasets = [d for d in contents_response.json() if d["history_content_type"] == "dataset"] # Assert two datasets in source were hidden. assert len(datasets) == 2 assert not datasets[0]["visible"] From d26186f54860b9eca84cf7fc69aa2c0c25b650df Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Wed, 27 Sep 2023 10:34:25 +0100 Subject: [PATCH 2/2] Remove overriding of ``copy_elements`` parameter Prevent unexpected behaviour of the API. Actually raise `RequestParameterInvalidException` exception if this conflicts with `copy_required` (i.e. dbkey not None). --- lib/galaxy/webapps/galaxy/services/history_contents.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/services/history_contents.py b/lib/galaxy/webapps/galaxy/services/history_contents.py index 0e6408227674..f811c7b781dd 100644 --- a/lib/galaxy/webapps/galaxy/services/history_contents.py +++ b/lib/galaxy/webapps/galaxy/services/history_contents.py @@ -1269,9 +1269,9 @@ def __create_dataset_collection( raise exceptions.RequestParameterMissingException("'content' id of target to copy is missing") dbkey = payload.dbkey copy_required = dbkey is not None - copy_elements = payload.copy_elements or copy_required + copy_elements = payload.copy_elements if copy_required and not copy_elements: - raise exceptions.RequestParameterMissingException( + raise exceptions.RequestParameterInvalidException( "copy_elements passed as 'false' but it is required to change specified attributes" ) dataset_instance_attributes = {}