diff --git a/test/api/test_tools.py b/test/api/test_tools.py index e1b5485ce5b..a0510b751fe 100644 --- a/test/api/test_tools.py +++ b/test/api/test_tools.py @@ -539,6 +539,59 @@ class ToolsTestCase( api.ApiTestCase ): } self._run_and_check_simple_collection_mapping( history_id, inputs ) + @skip_without_tool( "output_action_change_format" ) + def test_map_over_with_output_format_actions( self ): + for use_action in ["do", "dont"]: + history_id = self.dataset_populator.new_history() + hdca_id = self.__build_pair( history_id, [ "123", "456" ] ) + inputs = { + "input_cond|dispatch": use_action, + "input_cond|input": { 'batch': True, 'values': [ { 'src': 'hdca', 'id': hdca_id } ] }, + } + create = self._run( 'output_action_change_format', history_id, inputs ).json() + outputs = create[ 'outputs' ] + jobs = create[ 'jobs' ] + implicit_collections = create[ 'implicit_collections' ] + self.assertEquals( len( jobs ), 2 ) + self.assertEquals( len( outputs ), 2 ) + self.assertEquals( len( implicit_collections ), 1 ) + output1 = outputs[ 0 ] + output2 = outputs[ 1 ] + output1_details = self.dataset_populator.get_history_dataset_details( history_id, dataset=output1 ) + output2_details = self.dataset_populator.get_history_dataset_details( history_id, dataset=output2 ) + assert output1_details[ "file_ext" ] == "txt" if (use_action == "do") else "data" + assert output2_details[ "file_ext" ] == "txt" if (use_action == "do") else "data" + + @skip_without_tool( "Cut1" ) + def test_map_over_with_complex_output_actions( self ): + history_id = self.dataset_populator.new_history() + hdca_id = self._bed_list(history_id) + inputs = { + "columnList": "c1,c2,c3,c4,c5", + "delimiter": "T", + "input": { 'batch': True, 'values': [ { 'src': 'hdca', 'id': hdca_id } ] }, + } + create = self._run( 'Cut1', history_id, inputs ).json() + outputs = create[ 'outputs' ] + jobs = create[ 'jobs' ] + implicit_collections = create[ 'implicit_collections' ] + self.assertEquals( len( jobs ), 2 ) + self.assertEquals( len( outputs ), 2 ) + self.assertEquals( len( implicit_collections ), 1 ) + output1 = outputs[ 0 ] + output2 = outputs[ 1 ] + output1_content = self.dataset_populator.get_history_dataset_content( history_id, dataset=output1 ) + output2_content = self.dataset_populator.get_history_dataset_content( history_id, dataset=output2 ) + assert output1_content.startswith("chr1") + assert output2_content.startswith("chr1") + + def _bed_list(self, history_id): + bed1_contents = open(self.get_filename("1.bed"), "r").read() + bed2_contents = open(self.get_filename("2.bed"), "r").read() + contents = [bed1_contents, bed2_contents] + hdca = self.dataset_collection_populator.create_list_in_history( history_id, contents=contents ).json() + return hdca["id"] + def _run_and_check_simple_collection_mapping( self, history_id, inputs ): create = self._run_cat1( history_id, inputs=inputs, assert_ok=True ) outputs = create[ 'outputs' ] diff --git a/test/functional/tools/output_action_change_format.xml b/test/functional/tools/output_action_change_format.xml new file mode 100644 index 00000000000..c9a59cc70e8 --- /dev/null +++ b/test/functional/tools/output_action_change_format.xml @@ -0,0 +1,52 @@ + + + echo "1\t2" > out1; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/functional/tools/samples_tool_conf.xml b/test/functional/tools/samples_tool_conf.xml index 0f21dd8d712..8e7c621339c 100644 --- a/test/functional/tools/samples_tool_conf.xml +++ b/test/functional/tools/samples_tool_conf.xml @@ -35,6 +35,7 @@ +