summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.de>2010-03-15 09:13:34 +0100
committerChristoph Helma <helma@in-silico.de>2010-03-15 09:13:34 +0100
commitc70ef9606974d66e2b9fc7843c0900956ccc4e58 (patch)
tree431908f4a8ee2b41dd75129b790ee57ad0b9d002
parent06271a657095f10709c8a717c4093fca02d28020 (diff)
tests for yaml representation working
-rw-r--r--features/compound.feature1
-rw-r--r--features/dataset.feature11
-rw-r--r--features/fminer.feature1
-rw-r--r--features/lazar_single_prediction.feature1
-rw-r--r--features/step_definitions/common_steps.rb12
-rw-r--r--features/step_definitions/task_steps.rb3
6 files changed, 14 insertions, 15 deletions
diff --git a/features/compound.feature b/features/compound.feature
index f628f4b..99c2f4e 100644
--- a/features/compound.feature
+++ b/features/compound.feature
@@ -3,6 +3,7 @@ Feature: Create compound URI
Scenario Outline: Create and get URIs
Given Content-Type is <mime-type>
+ And Accept-Type is chemical/x-daylight-smiles
When I post <descriptor> to the compound webservice
Then I should receive a valid URI
And the URI should contain <inchi>
diff --git a/features/dataset.feature b/features/dataset.feature
deleted file mode 100644
index a606b9c..0000000
--- a/features/dataset.feature
+++ /dev/null
@@ -1,11 +0,0 @@
-@rest
-Feature: Dataset
-
- Scenario Outline: Create a dataset
- Given Content-Type is application/rdf+xml
- When I post <data> to the dataset webservice
- Then I should receive a valid URI
-
- Examples:
- |data|
- |file: hamster_carcinogenicity.owl|
diff --git a/features/fminer.feature b/features/fminer.feature
index 25faaef..bd79cdc 100644
--- a/features/fminer.feature
+++ b/features/fminer.feature
@@ -3,6 +3,7 @@ Feature: Fminer
Scenario Outline: Create fminer features
Given Content-Type is application/x-yaml
+ And Accept-Type is application/x-yaml
And I post <data> to the dataset webservice
And the task is completed
And I apply fminer for <feature>
diff --git a/features/lazar_single_prediction.feature b/features/lazar_single_prediction.feature
index cd9833d..8bccd4a 100644
--- a/features/lazar_single_prediction.feature
+++ b/features/lazar_single_prediction.feature
@@ -6,6 +6,7 @@ Feature: Create a model and predict an unknown compound
Scenario Outline:
Given Content-Type is application/x-yaml
+ And Accept-Type is application/x-yaml
And I post <data> to the dataset webservice
And the task is completed
And I create a lazar model for <feature>
diff --git a/features/step_definitions/common_steps.rb b/features/step_definitions/common_steps.rb
index e3eaaf1..d42f8ab 100644
--- a/features/step_definitions/common_steps.rb
+++ b/features/step_definitions/common_steps.rb
@@ -2,6 +2,10 @@ Given /^Content-Type is (.*)/ do |content_type|
@content_type = content_type
end
+Given /^Accept-Type is (.*)/ do |accept_type|
+ @accept_type = accept_type
+end
+
When /^I post (.*) to the (.*) webservice$/ do |data,component|
#puts @@config[:services].to_yaml
#puts @@config[:services]["opentox-#{component}"]
@@ -18,7 +22,7 @@ When /^I post (.*) to the (.*) webservice$/ do |data,component|
@uri = uri.chomp.to_s
@resources << @uri unless /compound|feature/ =~ component
end
- puts @uri
+ #puts @uri
end
Given /^The dataset uri is (.*)$/ do |uri|
@@ -29,14 +33,14 @@ end
When /^the task is completed$/ do
@task.wait_for_completion
@uri = @task.resource.chomp
- puts @uri
+ #puts @uri
@resources << @uri
end
Then /^I should receive a valid URI$/ do
#puts @uri
- @response = RestClient.get @uri, :accept => @content_type
- puts @response.to_yaml
+ @response = RestClient.get @uri, :accept => @accept_type
+ #puts @response.to_yaml
end
Then /^the URI should contain (.+)$/ do |result|
diff --git a/features/step_definitions/task_steps.rb b/features/step_definitions/task_steps.rb
index 1290350..271083b 100644
--- a/features/step_definitions/task_steps.rb
+++ b/features/step_definitions/task_steps.rb
@@ -1,15 +1,18 @@
When /^I create a task$/ do
@uri = RestClient::Resource.new(@@config[:services]["opentox-task"], :user => @@users[:users].keys[0], :password => @@users[:users].values[0]).post nil
+ @uri.chomp!
@resources << @uri
end
When /^I finish the task for (.*)$/ do |resource|
+ #puts File.join(@uri,"completed")
RestClient::Resource.new(File.join(@uri,"completed"), :user => @@users[:users].keys[0], :password => @@users[:users].values[0]).put :resource => resource
end
Then /^the status should be "([^\"]*)"$/ do |status|
+ #puts File.join(@uri,"status")
return_status = RestClient.get File.join(@uri,"status")
assert_equal status, return_status
end