diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-15 23:23:39 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-15 23:23:39 +0000 |
commit | 6175ca03be6d0d51359f9017123708987d0f5eb7 (patch) | |
tree | ecfcf6e79a21b1d25c3f6f42dd68ea0a14add89c /ruby_1_8_5/test/soap/test_no_indent.rb | |
parent | 80a56b248b2e9cfc95622aed98750df05a19f667 (diff) |
add tag v1_8_5_91v1_8_5_91
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_8_5_91@13046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby_1_8_5/test/soap/test_no_indent.rb')
-rw-r--r-- | ruby_1_8_5/test/soap/test_no_indent.rb | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/ruby_1_8_5/test/soap/test_no_indent.rb b/ruby_1_8_5/test/soap/test_no_indent.rb new file mode 100644 index 0000000000..f49fb7389f --- /dev/null +++ b/ruby_1_8_5/test/soap/test_no_indent.rb @@ -0,0 +1,86 @@ +require 'test/unit' +require 'soap/rpc/standaloneServer' +require 'soap/rpc/driver' + +if defined?(HTTPAccess2) + +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 |