diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-09 09:36:33 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-09 09:36:33 +0000 |
commit | 5ab3fe5fb5fd5d501665860843b8017a47af1109 (patch) | |
tree | 20207a27f0a370faaf0aab3ade7704d1ef3f59a7 /test/xmlrpc/test_webrick_server.rb | |
parent | 62b511b6aa9e2c1ceb11048f012eed13e5feabfb (diff) |
* test/xmlrpc: Refine log test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/xmlrpc/test_webrick_server.rb')
-rw-r--r-- | test/xmlrpc/test_webrick_server.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/test/xmlrpc/test_webrick_server.rb b/test/xmlrpc/test_webrick_server.rb index 36d64d5093..bc102390c3 100644 --- a/test/xmlrpc/test_webrick_server.rb +++ b/test/xmlrpc/test_webrick_server.rb @@ -11,19 +11,19 @@ module TestXMLRPC class Test_Webrick < Test::Unit::TestCase include WEBrick_Testing - @@basic_auth = WEBrick::HTTPAuth::BasicAuth.new( - :Realm => 'auth', - :UserDB => WEBrick::HTTPAuth::Htpasswd.new(File.expand_path('./htpasswd', File.dirname(__FILE__))), - :Logger => NoLog, - ) - - def create_servlet + def create_servlet(server) s = XMLRPC::WEBrickServlet.new - def s.service(req, res) - @@basic_auth.authenticate(req, res) + basic_auth = WEBrick::HTTPAuth::BasicAuth.new( + :Realm => 'auth', + :UserDB => WEBrick::HTTPAuth::Htpasswd.new(File.expand_path('./htpasswd', File.dirname(__FILE__))), + :Logger => server.logger, + ) + + class << s; self end.send(:define_method, :service) {|req, res| + basic_auth.authenticate(req, res) super(req, res) - end + } s.add_handler("test.add") do |a,b| a + b @@ -68,7 +68,7 @@ class Test_Webrick < Test::Unit::TestCase # NOTE: I don't enable SSL testing as this hangs [false].each do |use_ssl| option = setup_http_server_option(use_ssl) - with_server(option, create_servlet) {|addr| + with_server(option, method(:create_servlet)) {|addr| @s = XMLRPC::Client.new3(:host => addr.ip_address, :port => addr.ip_port, :use_ssl => use_ssl) @s.user = 'admin' @s.password = 'admin' |