blob: 3615f4861b1938d5f5fdff65636c06331801b80e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
Given /^Content-Type is (.*)/ do |content_type|
@content_type = content_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+/,'')))
@data = data
end
@uri = RestClient.post @@config[:services]["opentox-#{component}"], data, :content_type => @content_type
@resources << @uri unless /compound|feature/ =~ component
end
Given /^The dataset uri is (.*)$/ do |uri|
@uri = uri
# do not delete this !!
end
When /^the task is completed$/ do
@task.wait_for_completion
@uri = @task.resource
#puts @uri
@resources << @uri
end
Then /^I should receive a valid URI$/ do
puts @uri
@response = RestClient.get @uri, :accept => '*/*'
#puts @response.to_yaml
end
Then /^the URI should contain (.+)$/ do |result|
#puts @uri
regexp = /#{Regexp.escape(URI.encode(result))}/
assert regexp =~ @uri, true
end
Then /^the URI response should be (.+)$/ do |data|
case data
when /^file:/
data = @data
end
assert data == @response, true
end
|