From 6f5a7b200443baf209d2f33c428ed4a4059782f7 Mon Sep 17 00:00:00 2001 From: Leon Breedt Date: Fri, 25 Feb 2005 23:39:39 +0000 Subject: merged the changes for the upcoming 0.6.0: seperate out protocol marshaling into a small 'ws' library in vendor, so that AWS itself only does integration with ActionPack, and so we can keep protocol specific code in AWS proper to a minimum. refactor unit tests to get 95% code coverage (for a baseline). be far more relaxed about the types given to us by the remote side, don't do any poor man's type checking, just try to cast and marshal to the correct types if possible, and if not, return what they gave us anyway. this should make interoperating with fuzzy XML-RPC clients easier. if exception reporting is turned on, do best-effort error responses, so that we can avoid "Internal protocol error" with no details if there is a bug in AWS itself. also perform extensive cleanups on AWS proper. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@800 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionwebservice/test/client_xmlrpc_test.rb | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'actionwebservice/test/client_xmlrpc_test.rb') diff --git a/actionwebservice/test/client_xmlrpc_test.rb b/actionwebservice/test/client_xmlrpc_test.rb index cd393fbad6..53b6de51e1 100644 --- a/actionwebservice/test/client_xmlrpc_test.rb +++ b/actionwebservice/test/client_xmlrpc_test.rb @@ -9,12 +9,12 @@ module ClientXmlRpcTest test_request = ActionController::TestRequest.new test_request.request_parameters['action'] = req.path.gsub(/^\//, '').split(/\//)[1] test_request.env['REQUEST_METHOD'] = "POST" - test_request.env['HTTP_CONTENTTYPE'] = 'text/xml' + test_request.env['HTTP_CONTENT_TYPE'] = 'text/xml' test_request.env['RAW_POST_DATA'] = req.body - protocol_request = @controller.protocol_request(test_request) - response = @controller.dispatch_request(protocol_request) + response = ActionController::TestResponse.new + @controller.process(test_request, response) res.header['content-type'] = 'text/xml' - res.body = response.raw_body + res.body = response.body rescue Exception => e $stderr.puts e.message $stderr.puts e.backtrace.join("\n") @@ -89,4 +89,16 @@ class TC_ClientXmlRpc < Test::Unit::TestCase assert_equal(true, @client.named_parameters("xxx", 7)) assert_equal(["xxx", 7], @container.value_named_parameters) end + + def test_exception + assert_raises(ActionWebService::Client::ClientError) do + assert(@client.thrower) + end + end + + def test_invalid_signature + assert_raises(ActionWebService::Client::ClientError) do + @client.normal + end + end end -- cgit v1.2.3