summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/compound.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/compound.rb b/test/compound.rb
index 47a0aed..21758af 100644
--- a/test/compound.rb
+++ b/test/compound.rb
@@ -76,3 +76,32 @@ class CompoundTest < MiniTest::Test
end
end
+
+class CompoundServiceTest < MiniTest::Test
+
+ def test_formats # test supported formats from service
+ formats = ["chemical/x-daylight-smiles", "chemical/x-inchi", "chemical/x-mdl-sdfile", "chemical/x-mdl-molfile", "image/png", "text/html"]
+ formats.each do |format|
+ response = OpenTox::RestClientWrapper.get "#{$compound[:uri]}/InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H", {}, { :accept => format }
+ assert_equal format, response.headers[:content_type]
+ assert_equal 200, response.code
+ end
+ end
+
+end
+
+class CompoundAPITest < MiniTest::Test
+
+ def test_apifile # test if api file is present
+ format = "application/json"
+ response = OpenTox::RestClientWrapper.get "#{$compound[:uri]}/api/compound.json", {}, { :accept => format }
+ assert_equal format, response.headers[:content_type]
+ assert_equal 200, response.code
+ end
+
+ def test_swagger_valid
+ res = OpenTox::RestClientWrapper.get "http://online.swagger.io/validator/debug?url=#{$compound[:uri]}/api/compound.json"
+ assert_equal res, "[]", "Swagger API document #{$compound[:uri]}/api/compound.json is not valid: \n#{res}"
+ end
+
+end