From 34f3514d66f082a85fa1082536c4911a6809c7fd Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Tue, 16 Mar 2010 19:42:55 +0100 Subject: initial test for dataset prediction added --- features/fminer.feature | 1 - features/step_definitions/common_steps.rb | 2 -- features/step_definitions/lazar_steps.rb | 14 ++++++++++++++ features/support/hooks.rb | 2 ++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/features/fminer.feature b/features/fminer.feature index 4e1b83f..9e0dfed 100644 --- a/features/fminer.feature +++ b/features/fminer.feature @@ -5,7 +5,6 @@ Feature: Fminer 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 When the task is completed Then I should receive a valid URI diff --git a/features/step_definitions/common_steps.rb b/features/step_definitions/common_steps.rb index d42f8ab..1e01717 100644 --- a/features/step_definitions/common_steps.rb +++ b/features/step_definitions/common_steps.rb @@ -7,8 +7,6 @@ Given /^Accept-Type is (.*)/ do |accept_type| end When /^I post (.*) to the (.*) webservice$/ do |data,component| - #puts @@config[:services].to_yaml - #puts @@config[:services]["opentox-#{component}"] case data when /^file:/ data = File.read(File.join(File.dirname(File.expand_path(__FILE__)),"../data",data.sub(/file:\s+/,''))) diff --git a/features/step_definitions/lazar_steps.rb b/features/step_definitions/lazar_steps.rb index c05c07f..eca47a4 100644 --- a/features/step_definitions/lazar_steps.rb +++ b/features/step_definitions/lazar_steps.rb @@ -17,3 +17,17 @@ Then /^the model should predict (.*) for (.*)$/ do |activity,smiles| assert_equal activity.to_s, classification.to_s end +Given /^I post the test dataset (.*)$/ do |test_dataset| + data = File.read(File.join(File.dirname(File.expand_path(__FILE__)),"../data",test_dataset.sub(/file:\s+/,''))) + @test_uri = RestClient::Resource.new(@@config[:services]["opentox-dataset"], :user => @@users[:users].keys[0], :password => @@users[:users].values[0]).post(data, :content_type => @content_type).to_s.chomp + @resources << @test_uri +end + +Given /^I predict the test dataset$/ do + @uri = `curl -X POST -d 'dataset_uri=#{@test_uri}' -H 'Accept:application/x-yaml' #{@uri}`.chomp + #puts @uri + @task = OpenTox::Task.find(@uri) + #puts @task + @resources << @uri +end + diff --git a/features/support/hooks.rb b/features/support/hooks.rb index 0bc5f6f..1216317 100644 --- a/features/support/hooks.rb +++ b/features/support/hooks.rb @@ -3,6 +3,7 @@ Before do end After do |scenario| +#=begin @resources.uniq! @resources.each do |resource| begin @@ -11,4 +12,5 @@ After do |scenario| puts "Cannot delete " + resource end end +#=end end -- cgit v1.2.3