Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aarnetfilesender: update tests #134

Merged
merged 10 commits into from
Oct 7, 2024
28 changes: 23 additions & 5 deletions tools/aarnetfilesender/filesender.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
<macros>
<import>macros.xml</import>
</macros>
<expand macro="requirements" />
<expand macro="version_command" />
<expand macro="requirements"/>
<expand macro="version_command"/>
<command detect_errors="exit_code"><![CDATA[
#if $test != "":
filesender -h &&
exit 0;
#end if

#set $apiuser = $__user__.extra_preferences.get('aarnet_filesender_account|username', "").strip()
#set $apikey = $__user__.extra_preferences.get('aarnet_filesender_account|apikey', "").strip()

#if $apiuser == "" or $apikey == "":
echo "ERROR: Please enter your FileSender Username in your user preferences under the AARNet FileSender Account Info section" &&
echo "ERROR: Please enter your FileSender Username in your user preferences under the AARNet FileSender Account Info section" >&2 &&
exit 1;
#end if

Expand All @@ -32,15 +37,28 @@ mkdir filestosend &&
filesender -p -u '$apiuser' -a '$apikey' -b https://filesender.aarnet.edu.au/rest.php -f "[email protected]" -r '$to' filestosend >$output 2>&1
]]></command>
<inputs>
<param name="data" type="data" format="txt,data" multiple="true" optional="false" label="Datasets to be sent:" />
<param name="to" type="text" optional="true" label="Email address of recipent:"><sanitizer sanitize="False"/></param>
<param name="data" type="data" format="txt,data" multiple="true" optional="false" label="Datasets to be sent:"/>
<param name="to" type="text" optional="true" label="Email address of recipent:">
<sanitizer sanitize="False"/>
</param>
<param name="test" type="hidden" value=""/>
</inputs>
<outputs>
<data name="output" format="txt" hidden="false"/>
</outputs>
<tests>
<test expect_exit_code="1" expect_failure="true">
<param name="data" value="summary_statistics.txt"/>
<assert_stderr>
<has_text text="ERROR: Please enter your FileSender Username in your user preferences under the AARNet FileSender Account Info section"/>
</assert_stderr>
</test>
<test>
<param name="data" value="summary_statistics.txt"/>
<param name="test" value="true"/>
<assert_stdout>
<has_text text="File Sender CLI client"/>
</assert_stdout>
</test>
</tests>
<help>
Expand Down
Loading