Sha256: 90b95ae36702a82ab6f112452614f3148b32a1f2d9562936d6ad1a12e430d650

Contents?: true

Size: 2 KB

Versions: 74

Compression:

Stored size: 2 KB

Contents

require File.dirname(__FILE__) + '/abstract_dispatcher'

class TC_DispatcherActionControllerXmlRpc < Test::Unit::TestCase
  include DispatcherTest
  include DispatcherCommonTests

  def setup
    @direct_controller = DirectController.new
    @delegated_controller = DelegatedController.new
    @layered_controller = LayeredController.new
    @virtual_controller = VirtualController.new
    @protocol = ActionWebService::Protocol::XmlRpc::XmlRpcProtocol.create(@direct_controller)
  end

  def test_layered_dispatching
    mt_cats = do_method_call(@layered_controller, 'mt.getCategories')
    assert_equal(["mtCat1", "mtCat2"], mt_cats)
    blogger_cats = do_method_call(@layered_controller, 'blogger.getCategories')
    assert_equal(["bloggerCat1", "bloggerCat2"], blogger_cats)
  end

  def test_multicall
    response = do_method_call(@layered_controller, 'system.multicall', [
      {'methodName' => 'mt.getCategories'},
      {'methodName' => 'blogger.getCategories'},
      {'methodName' => 'mt.bool'},
      {'methodName' => 'blogger.str', 'params' => ['2000']},
      {'methodName' => 'mt.alwaysFail'},
      {'methodName' => 'blogger.alwaysFail'},
      {'methodName' => 'mt.blah'},
      {'methodName' => 'blah.blah'},
      {'methodName' => 'mt.person'}
    ])
    assert_equal [
      [["mtCat1", "mtCat2"]],
      [["bloggerCat1", "bloggerCat2"]],
      [true],
      ["2500"],
      {"faultCode" => 3, "faultString" => "MT AlwaysFail"},
      {"faultCode" => 3, "faultString" => "Blogger AlwaysFail"},
      {"faultCode" => 4, "faultMessage" => "no such method 'blah' on API DispatcherTest::MTAPI"},
      {"faultCode" => 4, "faultMessage" => "no such web service 'blah'"},
      [{"name"=>"person1", "id"=>1}]
    ], response
  end

  protected
    def exception_message(xmlrpc_fault_exception)
      xmlrpc_fault_exception.faultString
    end

    def is_exception?(obj)
      obj.is_a?(XMLRPC::FaultException)
    end

    def service_name(container)
      container.is_a?(DelegatedController) ? 'test_service' : 'api'
    end
end

Version data entries

74 entries across 74 versions & 26 rubygems

Version Path
GavinJoyce-actionwebservice-2.2.3 test/dispatcher_action_controller_xmlrpc_test.rb
datanoise-actionwebservice-2.1.0 test/dispatcher_action_controller_xmlrpc_test.rb
datanoise-actionwebservice-2.1.1 test/dispatcher_action_controller_xmlrpc_test.rb
datanoise-actionwebservice-2.2.2 test/dispatcher_action_controller_xmlrpc_test.rb
datanoise-actionwebservice-2.3.2 test/dispatcher_action_controller_xmlrpc_test.rb
davidsmalley-actionwebservice-2.3.1 test/dispatcher_action_controller_xmlrpc_test.rb
davidsmalley-actionwebservice-2.3 test/dispatcher_action_controller_xmlrpc_test.rb
dougbarth-actionwebservice-2.1.1 test/dispatcher_action_controller_xmlrpc_test.rb
dougbarth-actionwebservice-2.3.3 test/dispatcher_action_controller_xmlrpc_test.rb
dougbarth-actionwebservice-2.3.4 test/dispatcher_action_controller_xmlrpc_test.rb
feldpost-actionwebservice-2.3.3 test/dispatcher_action_controller_xmlrpc_test.rb
mozy-actionwebservice-2.3.2 test/dispatcher_action_controller_xmlrpc_test.rb
nmeans-actionwebservice-2.1.1 test/dispatcher_action_controller_xmlrpc_test.rb
panztel-actionwebservice-2.3.4 test/dispatcher_action_controller_xmlrpc_test.rb
pelle-actionwebservice-2.3.3 test/dispatcher_action_controller_xmlrpc_test.rb
rickenharp-actionwebservice-2.3.4 test/dispatcher_action_controller_xmlrpc_test.rb
tonycoco-actionwebservice-2.3.3 test/dispatcher_action_controller_xmlrpc_test.rb
tonycoco-actionwebservice-2.3.4 test/dispatcher_action_controller_xmlrpc_test.rb
keshav-actionwebservice-1.0.0 test/dispatcher_action_controller_xmlrpc_test.rb
datanoise-actionwebservice-2.3.5 test/dispatcher_action_controller_xmlrpc_test.rb