diff --git a/lib/galaxy_test/api/test_tools.py b/lib/galaxy_test/api/test_tools.py index 41d610f7b29e..5842fb6a4e9c 100644 --- a/lib/galaxy_test/api/test_tools.py +++ b/lib/galaxy_test/api/test_tools.py @@ -2591,6 +2591,53 @@ def test_allow_uri_if_protocol_on_deferred_input(self, history_id): output_content = self.dataset_populator.get_history_dataset_content(history_id, dataset=output) assert output_content.strip() == source_uri.strip() + @skip_without_tool("gx_allow_uri_if_protocol") + def test_allow_uri_if_protocol_on_collection_with_deferred(self, history_id): + source_uris = [ + "https://raw.githubusercontent.com/galaxyproject/galaxy/dev/test-data/simple_line.txt", + "https://raw.githubusercontent.com/galaxyproject/galaxy/dev/test-data/simple_line_alternative.txt", + ] + elements = [ + { + "src": "url", + "url": source_uri, + "deferred": True, + "ext": "txt", + } + for source_uri in source_uris + ] + targets = [ + { + "destination": {"type": "hdca"}, + "elements": elements, + "collection_type": "list", + "name": "deferred list", + } + ] + payload = { + "history_id": history_id, + "targets": json.dumps(targets), + } + fetch_response = self.dataset_populator.fetch(payload, wait=True) + dataset_collection = self.dataset_collection_populator.wait_for_fetched_collection(fetch_response) + hdca_id = dataset_collection["id"] + inputs = { + "input1": {"batch": True, "values": [{"src": "hdca", "id": hdca_id}]}, + } + run_response = self.dataset_populator.run_tool( + tool_id="gx_allow_uri_if_protocol", inputs=inputs, history_id=history_id + ) + hdca_id = run_response["implicit_collections"][0]["id"] + dataset_collection = self.dataset_populator.get_history_collection_details(history_id, id=hdca_id) + elements = dataset_collection["elements"] + assert len(elements) == 2 + for element in elements: + object = element["object"] + assert isinstance(object, dict) + assert object["state"] == "ok" + output_content = self.dataset_populator.get_history_dataset_content(history_id, dataset=object) + assert output_content.strip() in source_uris + @skip_without_tool("cat1") def test_run_deferred_mapping(self, history_id: str): elements = [ diff --git a/test/functional/tools/parameters/gx_allow_uri_if_protocol.xml b/test/functional/tools/parameters/gx_allow_uri_if_protocol.xml index 7821b49718fb..b6cd4d6d4205 100644 --- a/test/functional/tools/parameters/gx_allow_uri_if_protocol.xml +++ b/test/functional/tools/parameters/gx_allow_uri_if_protocol.xml @@ -1,18 +1,21 @@ '$output' - #else: - ## Here, the input is a regular dataset or a materialized dataset in case of a - ## deferred dataset which source URI has a protocol different than 'https'. - ## The output will be a copy of the input content. - cp '$input' '$output' + #for $input in $input1: + ## We should handle the case where the input must be treated as a URI with a specific protocol. + #if $input.is_deferred: + ## Here, the input is a deferred dataset which source URI has the protocol 'https'. + ## We append the URI to the output file. + echo '$input' >> '$output' + #else: + ## Here, the input is a regular dataset or a materialized dataset in case of a + ## deferred dataset which source URI has a protocol different than 'https'. + ## We append the content of the dataset to the output file. + cat '$input' >> '$output' + #end if + #end for ]]> - +