Skip to content

Commit

Permalink
add functional tool test
Browse files Browse the repository at this point in the history
  • Loading branch information
bernt-matthias committed Mar 10, 2024
1 parent abd2062 commit e2a2edb
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
59 changes: 59 additions & 0 deletions test/functional/tools/dbkey_data_filter_input.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<tool id="dbkey_data_filter_input" name="dbkey_data_filter_input" version="0.1.0" profile="22.9">
<description>Filter (single) data input on a dbkey</description>
<command><![CDATA[
cat '$inputs' > '$output' &&
echo $inputs.metadata.dbkey
echo $other.metadata.dbkey
]]></command>
<inputs>
<param name="inputs" type="data" format="txt" label="Inputs" help="" />
<param name="other" type="data" format="txt" label="Other">
<options>
<filter type="data_meta" key="dbkey" ref="inputs"/>
</options>
<validator type="no_options" message="No reference genome is available for the build associated with the selected input dataset" />
</param>
</inputs>

<outputs>
<data name="output" format="txt" />
</outputs>

<tests>
<!-- can choose a dbkey if it matches input -->
<test>
<param name="inputs" value="simple_line.txt" dbkey="hg19" />
<param name="other" value="simple_line_x2.txt" dbkey="hg19"/>
<output name="output" file="simple_line.txt" />
<assert_stdout>
<has_text text="hg19" n="2"/>
</assert_stdout>
</test>
<!-- choose any dbkey if not specified in reference -->
<test>
<param name="inputs" value="simple_line.txt" />
<param name="other" value="simple_line_x2.txt" dbkey="hg19"/>
<output name="output" file="simple_line.txt" />
<assert_stdout>
<has_text text="hg19" n="1"/>
</assert_stdout>
</test>
<!-- cant choose a dkkey different from reference
this test should actually fail (ie it should have:
expect_failure="true" and output assertions removed)
it doesnt because for testing currently no restrictions are
applied to datasets (like dbkey filters)
https://github.com/galaxyproject/galaxy/pull/12073
-->
<test>
<param name="inputs" value="simple_line.txt" dbkey="hg18" />
<param name="other" value="simple_line_x2.txt" dbkey="hg19"/>
<assert_stdout>
<has_text text="hg18" n="1"/>
<has_text text="hg19" n="1"/>
</assert_stdout>
</test>
</tests>
<help>
</help>
</tool>
1 change: 1 addition & 0 deletions test/functional/tools/sample_tool_conf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
<tool file="dbkey_filter_multi_input.xml" />
<tool file="dbkey_filter_collection.xml" />
<tool file="dbkey_output_action.xml" />
<tool file="dbkey_data_filter_input.xml" />
<tool file="composite_output.xml" />
<tool file="composite_output_tests.xml" />
<tool file="unicode_stream.xml" />
Expand Down

0 comments on commit e2a2edb

Please sign in to comment.