Sha256: f3de0c93a8c93a4f68e4a1d818459c9310b511850b70c94b75d377f7d2cb21fc
Contents?: true
Size: 1.88 KB
Versions: 1
Compression:
Stored size: 1.88 KB
Contents
require 'test/unit' require 'soap/rpc/standaloneServer' require 'soap/rpc/driver' if defined?(HTTPClient) module SOAP class TestNoIndent < Test::Unit::TestCase Port = 17171 class NopServer < SOAP::RPC::StandaloneServer def initialize(*arg) super add_rpc_method(self, 'nop') end def nop SOAP::RPC::SOAPVoid.new end end def setup @server = NopServer.new(self.class.name, nil, '0.0.0.0', Port) @server.level = Logger::Severity::ERROR @t = Thread.new { @server.start } @endpoint = "http://localhost:#{Port}/" @client = SOAP::RPC::Driver.new(@endpoint) @client.add_rpc_method('nop') end def teardown @server.shutdown @t.kill @t.join @client.reset_stream end INDENT_XML = %q[<?xml version="1.0" encoding="utf-8" ?> <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> <nop env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> </nop> </env:Body> </env:Envelope>] NO_INDENT_XML = %q[<?xml version="1.0" encoding="utf-8" ?> <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> <nop env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> </nop> </env:Body> </env:Envelope>] def test_indent @client.wiredump_dev = str = '' @client.options["soap.envelope.no_indent"] = false @client.nop assert_equal(INDENT_XML, parse_requestxml(str)) end def test_no_indent @client.wiredump_dev = str = '' @client.options["soap.envelope.no_indent"] = true @client.nop assert_equal(NO_INDENT_XML, parse_requestxml(str)) end def parse_requestxml(str) str.split(/\r?\n\r?\n/)[3] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
soap4r-1.5.7 | test/soap/test_no_indent.rb |