Skip to content

Commit

Permalink
Merge pull request #6213 from jmchilton/one_more_identifier_test
Browse files Browse the repository at this point in the history
Test element_identifier usage with single data parameters, in repeat/cond.
  • Loading branch information
mvdbeek authored Jun 4, 2018
2 parents b08455e + 48fda8d commit 6911153
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/api/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,27 @@ def test_identifier_multiple_reduce_in_repeat(self):
output1_content = self.dataset_populator.get_history_dataset_content(history_id, dataset=output1)
self.assertEquals(output1_content.strip(), "forward\nreverse")

@skip_without_tool("identifier_single_in_repeat")
def test_identifier_single_in_repeat(self):
history_id = self.dataset_populator.new_history()
hdca_id = self.__build_pair(history_id, ["123", "456"])
inputs = {
"the_repeat_0|the_data|input1": {'batch': True, 'values': [{'src': 'hdca', 'id': hdca_id}]}
}
create_response = self._run("identifier_single_in_repeat", history_id, inputs)
self._assert_status_code_is(create_response, 200)
create = create_response.json()
jobs = create['jobs']
implicit_collections = create['implicit_collections']
self.assertEquals(len(jobs), 2)
self.assertEquals(len(implicit_collections), 1)
output_collection = implicit_collections[0]
elements = output_collection["elements"]
assert len(elements) == 2
forward_output = elements[0]["object"]
output1_content = self.dataset_populator.get_history_dataset_content(history_id, dataset=forward_output)
assert output1_content.strip() == "forward", output1_content

@skip_without_tool("identifier_multiple_in_conditional")
def test_identifier_multiple_in_conditional(self):
history_id = self.dataset_populator.new_history()
Expand Down
25 changes: 25 additions & 0 deletions test/functional/tools/identifier_single_in_repeat.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<tool id="identifier_single_in_repeat" name="identifier_single_in_repeat">
<command><![CDATA[
#for $repeat_instance in $the_repeat#
echo '$repeat_instance.the_data.input1.element_identifier' >> 'output1';
#end for#
]]></command>
<inputs>
<repeat name="the_repeat" title="Repeat Inputs">
<conditional name="the_data">
<param name="cond_param" type="boolean" />
<when value="true">
<param type="data" name="input1" label="The Input" />
</when>
<when value="false">
<param type="data" name="input1" label="The Input" />
</when>
</conditional>
</repeat>
</inputs>
<outputs>
<data name="output1" format="tabular" from_work_dir="output1" />
</outputs>
<tests>
</tests>
</tool>
1 change: 1 addition & 0 deletions test/functional/tools/samples_tool_conf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
<tool file="explicit_conversion.xml" />
<tool file="identifier_source.xml" />
<tool file="identifier_single.xml" />
<tool file="identifier_single_in_repeat.xml" />
<tool file="identifier_multiple.xml" />
<tool file="identifier_multiple_in_conditional.xml" />
<tool file="identifier_multiple_in_repeat.xml" />
Expand Down

0 comments on commit 6911153

Please sign in to comment.