summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrautenberg <rautenberg@in-silico.ch>2013-12-06 16:40:12 +0100
committerrautenberg <rautenberg@in-silico.ch>2013-12-06 16:40:12 +0100
commite6ed98fb09140090f82c22c7dca894e4a60f0035 (patch)
tree3f90558a03ca05247fedaa2d869b1ae42d2d678d
parent84bce3613d11fa34bf18d46148aaf1293eafdae6 (diff)
make test order dependent to avoid uploading and deleting investigation for each single test
-rw-r--r--test/toxbank-investigation-sparql.rb36
1 files changed, 19 insertions, 17 deletions
diff --git a/test/toxbank-investigation-sparql.rb b/test/toxbank-investigation-sparql.rb
index 64a242c..95b03d7 100644
--- a/test/toxbank-investigation-sparql.rb
+++ b/test/toxbank-investigation-sparql.rb
@@ -3,8 +3,10 @@ require_relative "toxbank-setup.rb"
# Test API extension SPARQL templates
class TBSPARQLTest < Minitest::Unit::TestCase
+ i_suck_and_my_tests_are_order_dependent!
+
# login as pi and create a test investigation
- def setup
+ def test_00_create_investigation
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"
@@ -18,23 +20,23 @@ class TBSPARQLTest < Minitest::Unit::TestCase
end
# initial tests to be changed
- def test_nonexisting_template
+ def test_01_nonexisting_template
assert_raises OpenTox::ResourceNotFoundError do
response = OpenTox::RestClientWrapper.get "#{@@uri}/sparql/not_existing_template", {}, {:accept => "application/json", :subjectid => $pi[:subjectid]}
end
end
- def test_existing_template
+ def test_02_existing_template
response = OpenTox::RestClientWrapper.get "#{@@uri}/sparql/investigation_details", {}, {:accept => "application/json", :subjectid => $pi[:subjectid]}
assert_equal 200, response.code
end
- def test_camelcase_template
+ def test_03_camelcase_template
response = OpenTox::RestClientWrapper.get "#{@@uri}/sparql/InvestigationDetails", {}, {:accept => "application/json", :subjectid => $pi[:subjectid]}
assert_equal 200, response.code
end
- def test_factors_by_investigation
+ def test_04_factors_by_investigation
response = OpenTox::RestClientWrapper.get "#{@@uri}/sparql/factors_by_investigation", {}, {:accept => "application/json", :subjectid => $pi[:subjectid]}
result = JSON.parse(response)
factorvalues = result["results"]["bindings"].map {|n| "#{n["factorname"]["value"]}:::#{n["value"]["value"]}"}
@@ -49,7 +51,7 @@ class TBSPARQLTest < Minitest::Unit::TestCase
assert factorvalues.include?("rate:::0.07")
end
- def test_characteristics_by_investigation
+ def test_05_characteristics_by_investigation
response = OpenTox::RestClientWrapper.get "#{@@uri}/sparql/characteristics_by_investigation", {}, {:accept => "application/json", :subjectid => $pi[:subjectid]}
result = JSON.parse(response)
propnamevalues = result["results"]["bindings"].map {|n| "#{n["propname"]["value"]}:::#{n["value"]["value"]}:::#{n["ontouri"]["value"]}"}
@@ -59,62 +61,62 @@ class TBSPARQLTest < Minitest::Unit::TestCase
end
- def test_investigation_endpoint_technology
+ def test_06_investigation_endpoint_technology
response = OpenTox::RestClientWrapper.get "#{@@uri}/sparql/investigation_endpoint_technology", {}, {:accept => "application/json", :subjectid => $pi[:subjectid]}
result = JSON.parse(response)
endpointtechnologies = result["results"]["bindings"].map {|n| "#{n["endpoint"]["value"]}:::#{n["technology"]["value"]}"}
assert_equal endpointtechnologies.size, 4
end
- def test_investigation_and_characteristics
+ def test_07_investigation_and_characteristics
response = OpenTox::RestClientWrapper.get "#{$investigation[:uri]}/sparql/investigation_and_characteristics", {}, {:accept => "application/json", :subjectid => $pi[:subjectid]}
#puts response
assert_equal 200, response.code
end
- def test_investigations_and_protocols
+ def test_08_investigations_and_protocols
response = OpenTox::RestClientWrapper.get "#{$investigation[:uri]}/sparql/investigations_and_protocols", {}, {:accept => "application/json", :subjectid => $pi[:subjectid]}
#puts response
assert_equal 200, response.code
end
- def test_investigations_and_factors
+ def test_09_investigations_and_factors
response = OpenTox::RestClientWrapper.get "#{$investigation[:uri]}/sparql/investigations_and_factors", {}, {:accept => "application/json", :subjectid => $pi[:subjectid]}
#puts response
assert_equal 200, response.code
end
- def test_protocols_by_factors
+ def test_10_protocols_by_factors
response = OpenTox::RestClientWrapper.get "#{$investigation[:uri]}/sparql/protocols_by_factors", {:factorValues => "['']"}, {:accept => "application/json", :subjectid => $pi[:subjectid]}
#puts response
assert_equal 200, response.code
end
- def test_investigation_by_factors
+ def test_11_investigation_by_factors
response = OpenTox::RestClientWrapper.get "#{$investigation[:uri]}/sparql/investigation_by_factors", {:factorValues => "['']"}, {:accept => "application/json", :subjectid => $pi[:subjectid]}
#puts response
assert_equal 200, response.code
end
- def test_investigation_by_factor
+ def test_12_investigation_by_factor
response = OpenTox::RestClientWrapper.get "#{$investigation[:uri]}/sparql/investigations_and_factors", {:value => "http://purl.obolibrary.org/chebi/CHEBI:28748"}, {:accept => "application/json", :subjectid => $pi[:subjectid]}
#puts response
assert_equal 200, response.code
end
- def test_investigation_by_characteristic_value
+ def test_13_investigation_by_characteristic_value
response = OpenTox::RestClientWrapper.get "#{$investigation[:uri]}/sparql/investigation_by_characteristic_value", {:value => ""}, {:accept => "application/json", :subjectid => $pi[:subjectid]}
#puts response
assert_equal 200, response.code
end
- def test_investigation_by_characteristic_name
+ def test_14_investigation_by_characteristic_name
response = OpenTox::RestClientWrapper.get "#{$investigation[:uri]}/sparql/investigation_by_characteristic_name", {:value => ""}, {:accept => "application/json", :subjectid => $pi[:subjectid]}
#puts response
assert_equal 200, response.code
end
- def test_investigation_by_characteristic
+ def test_15_investigation_by_characteristic
response = OpenTox::RestClientWrapper.get "#{$investigation[:uri]}/sparql/investigation_by_characteristic", {:value => ""}, {:accept => "application/json", :subjectid => $pi[:subjectid]}
#puts response
assert_equal 200, response.code
@@ -123,7 +125,7 @@ class TBSPARQLTest < Minitest::Unit::TestCase
# delete investigation/{id}
# @note expect code 200
- def teardown
+ def test_90_delete_investigation
result = OpenTox::RestClientWrapper.delete @@uri.to_s, {}, {:subjectid => $pi[:subjectid]}
assert_equal 200, result.code
end