From 2e16fd539c06d890ab560765f98fdfda24884032 Mon Sep 17 00:00:00 2001 From: gebele Date: Tue, 16 Dec 2014 19:22:24 +0100 Subject: added test for relational operator in bio materials search --- test/toxbank-investigation-sparql.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/toxbank-investigation-sparql.rb b/test/toxbank-investigation-sparql.rb index 5b5bacb..e05b7a5 100644 --- a/test/toxbank-investigation-sparql.rb +++ b/test/toxbank-investigation-sparql.rb @@ -360,9 +360,9 @@ class TBSPARQLTestExtended < MiniTest::Test def test_20_investigation_by_gene_and_value # check for FC, pValue, qValue ["FC", "pvalue", "qvalue"].each do |value_type| - response = OpenTox::RestClientWrapper.get "#{$investigation[:uri]}/sparql/investigation_by_gene_and_value", {:geneIdentifiers => "['entrez:3075', 'uniprot:P10809']", :value => "#{value_type}:0.7"}, {:accept => "application/json", :subjectid => $pi[:subjectid]} + response = OpenTox::RestClientWrapper.get "#{$investigation[:uri]}/sparql/investigation_by_gene_and_value", {:geneIdentifiers => "['entrez:3075', 'uniprot:P10809']", :value => "#{value_type}:0.5", :relOperator => "below"}, {:accept => "application/json", :subjectid => $pi[:subjectid]} result = JSON.parse(response) - #puts response + puts response ["investigation", "datatype", "title", "value"].each do |v| assert result["head"]["vars"].include?(v.to_s) end @@ -370,6 +370,15 @@ class TBSPARQLTestExtended < MiniTest::Test end end + def test_20_investigation_by_gene_and_value_b + # check for FC, pValue, qValue + ["FC", "pvalue", "qvalue"].each do |value_type| + assert_raises OpenTox::BadRequestError do + response = OpenTox::RestClientWrapper.get "#{$investigation[:uri]}/sparql/investigation_by_gene_and_value", {:geneIdentifiers => "['entrez:3075', 'uniprot:P10809']", :value => "#{value_type}:0.5"}, {:accept => "application/json", :subjectid => $pi[:subjectid]} + end + end + end + def test_21_investigation_by_gene_and_value # check for valid request assert_raises OpenTox::BadRequestError do -- cgit v1.2.3