summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2012-03-02 09:40:08 +0000
committerChristoph Helma <helma@in-silico.ch>2012-03-02 09:40:08 +0000
commit53fe462b9c310bc84df50d058500772b7f3cbc3c (patch)
tree7858894c334cf5847c27c3b90cfee846891f89e6
parentcbc5f08e92c92601009f0c11c8ec67ede2894858 (diff)
error test fixed
-rw-r--r--lib/rest-client-wrapper.rb10
-rw-r--r--test/task.rb7
2 files changed, 6 insertions, 11 deletions
diff --git a/lib/rest-client-wrapper.rb b/lib/rest-client-wrapper.rb
index 0780dd5..17e1cd0 100644
--- a/lib/rest-client-wrapper.rb
+++ b/lib/rest-client-wrapper.rb
@@ -28,14 +28,14 @@ module OpenTox
@request = RestClient::Request.new(args)
# check input
- raise OpenTox::Error.new 400, "Invalid URI: '#{uri}'" unless URI.valid? uri
- raise OpenTox::Error.new 400, "Unreachable URI: '#{uri}'" unless URI.accessible? uri
- raise OpenTox::Error.new 400, "Headers are not a hash: #{headers.inspect}" unless headers==nil or headers.is_a?(Hash)
+ raise OpenTox::BadRequestError.new "Invalid URI: '#{uri}'" unless URI.valid? uri
+ raise OpenTox::BadRequestError.new "Unreachable URI: '#{uri}'" unless URI.accessible? uri
+ raise OpenTox::BadRequestError.new "Headers are not a hash: #{headers.inspect}" unless headers==nil or headers.is_a?(Hash)
# make sure that no header parameters are set in the payload
[:accept,:content_type,:subjectid].each do |header|
- raise OpenTox::Error.new 400, "#{header} should be submitted in the headers" if payload and payload.is_a?(Hash) and payload[header]
+ raise OpenTox::BadRequestError.new "#{header} should be submitted in the headers" if payload and payload.is_a?(Hash) and payload[header]
end
- raise OpenTox::Error.new 400, "waiting_task is not 'nil', OpenTox::SubTask or OpenTox::Task: #{waiting_task.class}" unless waiting_task.nil? or waiting_task.is_a?(OpenTox::Task) or waiting_task.is_a?(OpenTox::SubTask)
+ raise OpenTox::BadRequestError.new "waiting_task is not 'nil', OpenTox::SubTask or OpenTox::Task: #{waiting_task.class}" unless waiting_task.nil? or waiting_task.is_a?(OpenTox::Task) or waiting_task.is_a?(OpenTox::SubTask)
begin
diff --git a/test/task.rb b/test/task.rb
index d49871f..932d5c9 100644
--- a/test/task.rb
+++ b/test/task.rb
@@ -10,8 +10,6 @@ TASK_SERVICE_URI = "http://ot-dev.in-silico.ch/task"
class TaskTest < Test::Unit::TestCase
-=begin
-=end
def test_all
all = OpenTox::Task.all(TASK_SERVICE_URI)
assert_equal Array, all.class
@@ -75,12 +73,9 @@ class TaskTest < Test::Unit::TestCase
end
assert task.running?
assert_equal "Running", task.hasStatus
- puts task.uri
task.wait
assert task.error?
- #assert_equal "Error", task.hasStatus
+ assert_equal "Error", task.hasStatus
end
-=begin
-=end
end