summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMicha Rautenberg <rautenberg@in-silico.ch>2015-10-30 12:07:45 +0100
committerMicha Rautenberg <rautenberg@in-silico.ch>2015-10-30 12:07:45 +0100
commit04d910a28ee46a7598f7b2db65f15f3885f935ae (patch)
tree2ce92ff1deae6ff7e24a385a28ed107ca57cc362 /test
parentf8e58e6bc7f101dfe07509751f0943918f19a082 (diff)
Test: expand descriptor tests and request setup from lazar test for datadir
Diffstat (limited to 'test')
-rw-r--r--test/descriptor.rb28
-rw-r--r--test/setup.rb5
2 files changed, 27 insertions, 6 deletions
diff --git a/test/descriptor.rb b/test/descriptor.rb
index 1a57766..3f9491c 100644
--- a/test/descriptor.rb
+++ b/test/descriptor.rb
@@ -6,10 +6,30 @@ $host = "https://mr-test.in-silico.ch"
class DescriptorTest < MiniTest::Test
def test_00_get_descriptors
- res = RestClientWrapper.get File.join($host, "algorithm/descriptor"), {}, {:accept => "text/plain"}
- assert_equal res.code, 200
- assert res.include?("Joelib.KierShape1: no description available\nJoelib.KierShape2: no description available")
+ result = RestClientWrapper.get File.join($host, "algorithm/descriptor"), {}, {:accept => "text/plain"}
+ assert_equal result.code, 200
+ assert result.include?("Joelib.KierShape1: no description available\nJoelib.KierShape2: no description available"), "Descriptor list is not complete."
+ assert_equal 110, result.lines.count
end
+ def test_01_get_descriptor
+ result = RestClientWrapper.get File.join($host, "algorithm/descriptor", "Openbabel.MW"), {}, {:accept => "text/plain"}
+ assert_equal result.code, 200
+ assert_equal result, "Molecular Weight filter"
+ end
+
+ def test_02_post_descriptor
+ result = RestClientWrapper.post File.join($host, "algorithm/descriptor"), {:identifier => "CC(=O)CC(C)C#N", :descriptor => "Joelib.LogP"}, {:accept => "application/csv"}
+ assert_equal result.code, 200
+ assert_equal "SMILES,Joelib.LogP\nCC(=O)CC(C)C#N,2.65908\n", result
+ end
+
+ def test_03_post_descriptor_file
+ file = File.join(DATA_DIR, "hamster_carcinogenicity.mini.csv")
+ result = RestClientWrapper.post File.join($host, "algorithm/descriptor"), {:file => File.open(file), :descriptor => "Openbabel.logP,Cdk.AtomCount,Cdk.CarbonTypes,Joelib.LogP"}, {:accept => "application/json"}
+ assert_equal result.code, 200
+ proof_result = File.read(File.join(REST_DATA_DIR, "test_03_post_descriptor_file.result"))
+ assert_equal result, proof_result.strip
+ end
-end \ No newline at end of file
+end
diff --git a/test/setup.rb b/test/setup.rb
index 91b8484..0ca77c6 100644
--- a/test/setup.rb
+++ b/test/setup.rb
@@ -1,6 +1,7 @@
require 'minitest/autorun'
require_relative '../../lazar/lib/lazar.rb'
+require_relative '../../lazar/test/setup.rb'
include OpenTox
-TEST_DIR ||= File.expand_path(File.dirname(__FILE__))
-DATA_DIR ||= File.join(TEST_DIR,"data")
+REST_TEST_DIR ||= File.expand_path(File.dirname(__FILE__))
+REST_DATA_DIR ||= File.join(REST_TEST_DIR,"data")