summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrautenberg <rautenberg@in-silico.ch>2013-11-29 17:33:29 +0100
committerrautenberg <rautenberg@in-silico.ch>2013-11-29 17:33:29 +0100
commit166f89868eb9ef85869195b4a16ddf19610b4b3e (patch)
tree3cf9c44d3642a921b2494679959c0f279627dac8
parent610e5856368d4a241f8dcf5bf72add509162be42 (diff)
initial test file for SPARQL extension
-rw-r--r--test/toxbank-investigation-sparql.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/toxbank-investigation-sparql.rb b/test/toxbank-investigation-sparql.rb
new file mode 100644
index 0000000..bd8a525
--- /dev/null
+++ b/test/toxbank-investigation-sparql.rb
@@ -0,0 +1,33 @@
+require_relative "toxbank-setup.rb"
+
+# Test API extension SPARQL templates
+class TBSPARQLTest < MiniTest::Test
+
+ # login as pi and create a test investigation
+ def setup
+ OpenTox::RestClientWrapper.subjectid = $pi[:subjectid] # set pi as the logged in user
+ @@uri = ""
+ file = File.join File.dirname(__FILE__), "data/toxbank-investigation/valid", "BII-I-1b-tb2.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} ."
+ @@uri = URI(uri)
+ end
+
+ # initial test to be changed
+ def test_01_initial
+ response = OpenTox::RestClientWrapper.get "#{@@uri}/sparql/not_existing_template", {}, {:accept => "application/rdf+xml", :subjectid => $pi[:subjectid]}
+ assert_equal 200, response.code
+ end
+
+ # delete investigation/{id}
+ # @note expect code 200
+ def teardown
+ result = OpenTox::RestClientWrapper.delete @@uri.to_s, {}, {:subjectid => $pi[:subjectid]}
+ assert_equal 200, result.code
+ end
+
+end \ No newline at end of file