diff options
author | Christoph Helma <helma@in-silico.de> | 2009-07-21 18:24:36 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.de> | 2009-07-21 18:24:36 +0200 |
commit | 678a9667e25c5ca20338938474e39a3cdefa7c3e (patch) | |
tree | 7ac1d9d1ee838ea54dcfb35392bde1e17164b78a /test.rb |
Initial import of opentox-dataset
Diffstat (limited to 'test.rb')
-rw-r--r-- | test.rb | 46 |
1 files changed, 46 insertions, 0 deletions
@@ -0,0 +1,46 @@ +ENV['RACK_ENV'] = 'test' +require 'datasets' +require 'test/unit' +require 'rack/test' + + +class DatasetsTest < Test::Unit::TestCase + include Rack::Test::Methods + + def app + Sinatra::Application + end + + def test_index + get '/' + assert last_response.ok? + end + + def test_create_dataset + authorize "api", API_KEY + post '/', :dataset_name => "Test dataset" + assert last_response.ok? + assert_equal "http://example.org/1", last_response.body.chomp + end + + def test_create_dataset_and_insert_data + authorize "api", API_KEY + post '/', :dataset_name => "Test dataset" + puts last_response.body + put '/1', :feature_name => "New feature", :feature_value => "inactive", :compound_name => 'Benzene' + puts last_response.body + put '/1', :feature_name => "New feature", :feature_value => "active", :compound_name => 'Dioxin' + get '/1' + puts last_response.body.chomp + assert last_response.ok? + end + + def test_unauthorized_create + post '/', :dataset_name => "Test dataset", :feature_name => "Test feature", :file => File.new('tests/example.tab') + assert !last_response.ok? + end + + def test_post_to_existing_dataset + end + +end |