From b4ae6c5c91fb8dca26997c2adf61ce1e90e2e3fa Mon Sep 17 00:00:00 2001 From: gebele Date: Wed, 8 Jan 2014 11:59:15 +0100 Subject: added test for files with whitespce in title --- .../valid/BII-I-1-tb2_whitespaces.zip | Bin 0 -> 13447 bytes test/toxbank-investigation-rest.rb | 15 +++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 test/data/toxbank-investigation/valid/BII-I-1-tb2_whitespaces.zip diff --git a/test/data/toxbank-investigation/valid/BII-I-1-tb2_whitespaces.zip b/test/data/toxbank-investigation/valid/BII-I-1-tb2_whitespaces.zip new file mode 100644 index 0000000..bd43191 Binary files /dev/null and b/test/data/toxbank-investigation/valid/BII-I-1-tb2_whitespaces.zip differ diff --git a/test/toxbank-investigation-rest.rb b/test/toxbank-investigation-rest.rb index a8c8028..5e356f4 100644 --- a/test/toxbank-investigation-rest.rb +++ b/test/toxbank-investigation-rest.rb @@ -111,6 +111,21 @@ class TBInvestigationREST < MiniTest::Test end end + def test_01e_upload_zip_with_whitespace_in_file_title + file = File.join File.dirname(__FILE__), "data/toxbank-investigation/valid", "BII-I-1-tb2_whitespaces.zip" + response = OpenTox::RestClientWrapper.post $investigation[:uri], {:file => File.open(file)}, { :subjectid => $pi[:subjectid] } + task_uri = response.chomp + task = OpenTox::Task.new task_uri + task.wait + uri = task.resultURI + assert_equal "Completed", task.hasStatus, "Task should be completed but is: #{task.hasStatus}. Task URI is #{task_uri} ." + urilist = OpenTox::RestClientWrapper.get( uri, {}, {:accept => 'text/uri-list', :subjectid => $pi[:subjectid] }).split("\n") + assert_match /a_micro%20array\.txt/, urilist.to_s + singlefile = OpenTox::RestClientWrapper.get "#{uri}/isatab/a_micro%20array.txt", {}, {:accept => 'text/plain', :subjectid => $pi[:subjectid] } + assert_equal singlefile.code.to_s, "200" + OpenTox::RestClientWrapper.delete uri.to_s, {}, {:subjectid => $pi[:subjectid]} + end + # create an investigation by uploading a zip file, # @todo TODO create by uploading text/tab-separated-values # @todo TODO create by uploading application/vnd.ms-excel -- cgit v1.2.3