mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #82 from jmchilton/output_action_testing
More functional tests of output actions.
This commit is contained in:
@@ -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' ]
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<tool id="output_action_change_format" name="output_action_change_format" version="1.0.0">
|
||||
<command>
|
||||
echo "1\t2" > out1;
|
||||
</command>
|
||||
<inputs>
|
||||
<conditional name="input_cond">
|
||||
<param type="select" name="dispatch" label="Dispatch on type">
|
||||
<option value="dont">Dont</option>
|
||||
<option value="do">Do</option>
|
||||
</param>
|
||||
<when value="dont">
|
||||
<param type="data" name="input" format="data" />
|
||||
</when>
|
||||
<when value="do">
|
||||
<param type="data" name="input" format="data" />
|
||||
</when>
|
||||
</conditional>
|
||||
</inputs>
|
||||
<outputs>
|
||||
<data name="out1" from_work_dir="out1">
|
||||
<actions>
|
||||
<conditional name="input_cond.dispatch">
|
||||
<when value="do">
|
||||
<action type="format">
|
||||
<option type="from_param" name="input_cond.input" param_attribute="ext" />
|
||||
</action>
|
||||
</when>
|
||||
</conditional>
|
||||
</actions>
|
||||
</data>
|
||||
</outputs>
|
||||
<tests>
|
||||
<test>
|
||||
<param name="dispatch" value="dont" />
|
||||
<param name="input" value="simple_line.txt" />
|
||||
<output name="out1" ftype="data">
|
||||
<assert_contents>
|
||||
<has_line line="1	2" />
|
||||
</assert_contents>
|
||||
</output>
|
||||
</test>
|
||||
<test>
|
||||
<param name="dispatch" value="do" />
|
||||
<param name="input" value="simple_line.txt" />
|
||||
<output name="out1" ftype="txt">
|
||||
<assert_contents>
|
||||
<has_line line="1	2" />
|
||||
</assert_contents>
|
||||
</output>
|
||||
</test>
|
||||
</tests>
|
||||
</tool>
|
||||
@@ -35,6 +35,7 @@
|
||||
<tool file="identifier_single.xml" />
|
||||
<tool file="identifier_multiple.xml" />
|
||||
<tool file="tool_directory.xml" />
|
||||
<tool file="output_action_change_format.xml" />
|
||||
<tool file="collection_paired_test.xml" />
|
||||
<tool file="collection_nested_test.xml" />
|
||||
<tool file="collection_mixed_param.xml" />
|
||||
|
||||
Reference in New Issue
Block a user