summaryrefslogtreecommitdiff
path: root/test/error.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2012-03-07 17:13:48 +0000
committerChristoph Helma <helma@in-silico.ch>2012-03-07 17:13:48 +0000
commit2f6d5c75fc1fece5fc10cc7c45ad59cf6b820d64 (patch)
treef3fdad09917e6ba537d049215221545709d721fd /test/error.rb
parent8fc11578aadcf1e7d152764c926e12e553bd8d65 (diff)
error and dataset tests added, wait_for_task moved to URI.to_object
Diffstat (limited to 'test/error.rb')
-rw-r--r--test/error.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/error.rb b/test/error.rb
new file mode 100644
index 0000000..af5db52
--- /dev/null
+++ b/test/error.rb
@@ -0,0 +1,35 @@
+require 'test/unit'
+$LOAD_PATH << File.join(File.dirname(__FILE__),'..','lib')
+require File.join File.dirname(__FILE__),'..','lib','opentox-client.rb'
+
+class ErrorTest < Test::Unit::TestCase
+
+ def test_bad_request
+ object = OpenTox::Feature.new "http://this-is-a/fantasy/url"
+ assert_raise OpenTox::BadRequestError do
+ response = object.get
+ end
+ end
+
+ def test_error_methods
+ assert_raise OpenTox::NotFoundError do
+ not_found_error "This is a test"
+ end
+ end
+
+ def test_exception
+ assert_raise Exception do
+ raise Exception.new "Basic Exception"
+ end
+ end
+
+ def test_backtick
+ assert_raise OpenTox::InternalServerError do
+ `this call will not work`
+ end
+ assert_raise OpenTox::InternalServerError do
+ `ls inexisting_directory`
+ end
+ end
+
+end