summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2013-10-23 13:15:44 +0200
committergebele <gebele@in-silico.ch>2013-10-23 13:15:44 +0200
commit04221dcb67f019886f92fca1303544219fd29e56 (patch)
treee6802cc4b2470ee259b7f83b49175ec4ba608e62
parent55ec71092f200220f225c60126478899bb330ad4 (diff)
reviewed code
-rw-r--r--test/toxbank-investigation-curl.rb8
-rw-r--r--test/toxbank-investigation-xls.rb5
2 files changed, 7 insertions, 6 deletions
diff --git a/test/toxbank-investigation-curl.rb b/test/toxbank-investigation-curl.rb
index 07033f6..cee6b14 100644
--- a/test/toxbank-investigation-curl.rb
+++ b/test/toxbank-investigation-curl.rb
@@ -33,12 +33,14 @@ class UploadTest < MiniTest::Test
# upload
OpenTox::RestClientWrapper.subjectid = $pi[:subjectid]
["BII-I-1-tb2.zip","E-MTAB-798_philippe-tb2.zip"].each do |f|
+ puts f
file = File.join File.dirname(__FILE__), "data/toxbank-investigation/valid", f
response = `curl -Lk -X POST -i -F file="@#{file};type=application/zip" -H "subjectid:#{$pi[:subjectid]}" #{$investigation[:uri]}`.chomp
assert_match /202/, response
taskuri = response.split("\n")[-1]
t = OpenTox::Task.new taskuri
t.wait
+ puts t.uri
assert_equal true, t.completed?
assert_match t.hasStatus, "Completed"
uri = t.resultURI
@@ -52,7 +54,7 @@ class UploadTest < MiniTest::Test
# get isatab files
urilist = `curl -Lk -H "subjectid:#{$pi[:subjectid]}" -H "Accept:text/uri-list" #{uri}`.split("\n")
urilist.each do |u|
- unless u.match(/[n3|zip]$/)
+ unless u.match(/[nt|zip]$/)
response = `curl -Lk -i -H "Accept:text/tab-separated-values" -H "subjectid:#{$pi[:subjectid]}" #{u}`
assert_match /HTTP\/1.1 200 OK/, response.to_s.encode!('UTF-8', 'UTF-8', :invalid => :replace)
end
@@ -62,10 +64,9 @@ class UploadTest < MiniTest::Test
assert_match /200/, response
response = `curl -Lk -i -H "Accept:text/uri-list" -H "subjectid:#{$pi[:subjectid]}" #{uri}`
assert_match /401|404/, response
- response = `curl -I -Lk -i -H "Accept:text/uri-list" -H "subjectid:#{$pi[:subjectid]}" #{uri}`
- assert_match /404|404/, response
end
end
+
def test_04_invalid_zip_upload
OpenTox::RestClientWrapper.subjectid = $pi[:subjectid]
file = File.join File.dirname(__FILE__), "data/toxbank-investigation/invalid/isa_TB_ACCUTOX.zip"
@@ -74,6 +75,7 @@ class UploadTest < MiniTest::Test
uri = response.split("\n")[-1]
t = OpenTox::Task.new(uri)
t.wait
+ puts t.uri
assert_match t.hasStatus, "Error"
# TODO: test errorReport, rdf output of tasks has to be fixed for that purpose
end
diff --git a/test/toxbank-investigation-xls.rb b/test/toxbank-investigation-xls.rb
index c449813..ee5f1ba 100644
--- a/test/toxbank-investigation-xls.rb
+++ b/test/toxbank-investigation-xls.rb
@@ -22,11 +22,10 @@ class ExcelUploadTest < MiniTest::Test
def test_02_valid_xls_upload
# upload
- file = File.join File.dirname(__FILE__), "data/toxbank-investigation/valid/isa_TB_BII.xls"
+ file = File.join File.dirname(__FILE__), "data/toxbank-investigation/valid/BII-I-1-tb2.xls"
response = `curl -Lk -X POST -i -F file="@#{file};type=application/vnd.ms-excel" -H "subjectid:#{$pi[:subjectid]}" #{$investigation[:uri]}`.chomp
assert_match /202/, response
uri = response.split("\n")[-1]
- OpenTox::RestClientWrapper.subjectid = $pi[:subjectid]
t = OpenTox::Task.new(uri)
t.wait
puts t.uri
@@ -63,5 +62,5 @@ class ExcelUploadTest < MiniTest::Test
response = `curl -I -Lk -i -H "Accept:text/uri-list" -H "subjectid:#{$pi[:subjectid]}" #{uri}`
assert_match /404/, response
end
-
+
end