File: test_fault.rb

package info (click to toggle)
ruby-soap4r 2.0.5-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,032 kB
  • sloc: ruby: 52,729; xml: 266; sh: 42; javascript: 20; makefile: 13; perl: 10
file content (46 lines) | stat: -rw-r--r-- 940 bytes parent folder | download | duplicates (5)
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
require 'test/unit'
require 'soap/rpc/driver'
require 'soap/rpc/standaloneServer'


module SOAP
module Fault


class TestFault < Test::Unit::TestCase

  def setup
    @client = SOAP::RPC::Driver.new(nil, 'urn:fault')
    @client.wiredump_dev = STDERR if $DEBUG
    @client.add_method("hello", "msg")
  end

  def teardown
    @client.reset_stream if @client
  end

  def test_fault
    @client.mapping_registry = SOAP::Mapping::EncodedRegistry.new
    @client.test_loopback_response << <<__XML__
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>DN cannot be empty</faultstring>
      <detail />
    </soap:Fault>
  </soap:Body>
</soap:Envelope>
__XML__
    begin
      @client.hello("world")
      assert(false)
    rescue ::SOAP::FaultError => e
      assert_equal("DN cannot be empty", e.message)
    end
  end
end


end
end