summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrautenberg <rautenberg@in-silico.ch>2014-06-02 09:30:14 +0200
committerrautenberg <rautenberg@in-silico.ch>2014-06-02 09:30:14 +0200
commitae981387369f7501f6e935390a827b77017eedf4 (patch)
tree34ea3002a89badba17b4fd8e3152b58c65e2cb67
parent910310a0b23c5572b7c6c5005a51adb9c8eb9e3a (diff)
add json test
-rw-r--r--test/toxbank-investigation-ftp.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/toxbank-investigation-ftp.rb b/test/toxbank-investigation-ftp.rb
index 6c4c8ff..69702d8 100644
--- a/test/toxbank-investigation-ftp.rb
+++ b/test/toxbank-investigation-ftp.rb
@@ -52,6 +52,20 @@ class TBInvestigationFTP < MiniTest::Test
end
end
+ # check http://api.toxbank.net/index.php/Investigation#Get_a_list_of_uploaded_FTP_files
+ def test_04_check_ftpfiles_json
+ response = OpenTox::RestClientWrapper.get $investigation[:uri]+"/ftpfiles", {}, {:accept => "application/json", :subjectid => $pi[:subjectid] }
+ assert_equal "200", response.code.to_s
+ assert !!JSON.parse(response)
+ result = JSON.parse(response)
+ files_to_check = ["subdir/JIC37_Ethanol_0.07_Internal_1_3.txt","JIC37_Ethanol_0.07_Internal_1_3.txt","subdir/isttest.txt","isttest.txt","#{$testdir}/#{File.basename($testfile)}"]
+ files_to_check.each do |ftc|
+ chk = false
+ result["results"]["bindings"].find{|f| chk = true if f["filename"]["value"] == ftc}
+ assert chk, "File: #{ftc} is not in ftpfiles json list"
+ end
+ end
+
# delete file from test_02
def test_04_delete_file
$ftp.delete(File.basename($testfile))