summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMicha Rautenberg <rautenberg@in-silico.ch>2015-10-19 17:49:15 +0200
committerMicha Rautenberg <rautenberg@in-silico.ch>2015-10-19 17:49:15 +0200
commitf41cb049445a8817298a3a64899c7a70be2c8ee9 (patch)
treebbc259908e41aa7e5649856ace424267ebde8d47 /test
parentf69788a9172d0cfb6b7af14cb467e009f0fbff01 (diff)
add basic compound request
Diffstat (limited to 'test')
-rw-r--r--test/compound.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/compound.rb b/test/compound.rb
index 914b645..01cd9b5 100644
--- a/test/compound.rb
+++ b/test/compound.rb
@@ -8,7 +8,46 @@ class CompoundTest < MiniTest::Test
def test_00_get_inchi
res = RestClientWrapper.get File.join($compound_uri, $compound[0]), {}, {:accept => "chemical/x-inchi"}
assert_equal res.code, 200
+ assert_equal res, "InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H"
+ end
+ def test_01_get_smiles
+ res = RestClientWrapper.get File.join($compound_uri, $compound[0]), {}, {:accept => "chemical/x-daylight-smiles"}
+ assert_equal res.code, 200
+ assert_equal res, "c1ccccc1"
+ end
+
+ def test_02_get_sdf
+ res = RestClientWrapper.get File.join($compound_uri, $compound[0]), {}, {:accept => "chemical/x-mdl-sdfile"}
+ assert_equal res.code, 200
+ assert res.include?("OpenBabel10191511303D")
+ end
+
+ def test_03_get_png
+ res = RestClientWrapper.get File.join($compound_uri, $compound[0]), {}, {:accept => "image/png"}
+ assert_equal res.code, 200
+ assert_equal "image/png", res.headers[:content_type]
+ end
+
+ def test_04_get_svg
+ res = RestClientWrapper.get File.join($compound_uri, $compound[0]), {}, {:accept => "image/svg+xml"}
+ assert_equal res.code, 200
+ assert res.include?("<svg version=")
+ end
+
+ def test_05_get_json
+ res = RestClientWrapper.get File.join($compound_uri, $compound[0]), {}, {:accept => "application/json"}
+ assert_equal res.code, 200
+ assert res.include?("{\"_id\":{\"$oid\":")
+ js = JSON.parse res
+ assert_equal js["chemblid"], "CHEMBL581676"
+ end
+
+ def test_06_get_names
+ res = RestClientWrapper.get File.join($compound_uri, $compound[0]), {}, {:accept => "text/plain"}
+ assert_equal res.code, 200
+ assert res.include?("Benzene")
+ assert res.include?("401765_ALDRICH")
end
end