From c70ef9606974d66e2b9fc7843c0900956ccc4e58 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Mon, 15 Mar 2010 09:13:34 +0100 Subject: tests for yaml representation working --- features/compound.feature | 1 + features/dataset.feature | 11 ----------- features/fminer.feature | 1 + features/lazar_single_prediction.feature | 1 + features/step_definitions/common_steps.rb | 12 ++++++++---- features/step_definitions/task_steps.rb | 3 +++ 6 files changed, 14 insertions(+), 15 deletions(-) delete mode 100644 features/dataset.feature 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 + And Accept-Type is chemical/x-daylight-smiles When I post to the compound webservice Then I should receive a valid URI And the URI should contain 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 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 to the dataset webservice And the task is completed And I apply fminer for 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 to the dataset webservice And the task is completed And I create a lazar model for 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 -- cgit v1.2.3