aboutsummaryrefslogtreecommitdiffstats
path: root/test/webrick/test_httpauth.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-08 15:38:33 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-08 15:38:33 +0000
commit742bbbb01b310440a7672fabddd016226d20bee7 (patch)
tree735522e7c5325517e91b5bbb3932d1596a4ec2b7 /test/webrick/test_httpauth.rb
parent8222432c9db1432995538a5d355d014c6fd1a0e9 (diff)
downloadruby-742bbbb01b310440a7672fabddd016226d20bee7.tar.gz
* test/webrick: Examine log and use assert_join_threads.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/webrick/test_httpauth.rb')
-rw-r--r--test/webrick/test_httpauth.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/test/webrick/test_httpauth.rb b/test/webrick/test_httpauth.rb
index 6668e1bacf..b0cb8a05bf 100644
--- a/test/webrick/test_httpauth.rb
+++ b/test/webrick/test_httpauth.rb
@@ -27,7 +27,7 @@ class TestWEBrickHTTPAuth < Test::Unit::TestCase
end
def test_basic_auth2
- TestWEBrick.start_httpserver{|server, addr, port, log|
+ log = TestWEBrick.start_httpserver{|server, addr, port, log|
realm = "WEBrick's realm"
path = "/basic_auth2"
@@ -61,6 +61,11 @@ class TestWEBrickHTTPAuth < Test::Unit::TestCase
http.request(g){|res| assert_not_equal("hoge", res.body, log.call)}
}
}
+ pat = /ERROR Basic WEBrick's realm: webrick: password unmatch\./
+ assert_match(pat, log); log.sub!(pat, '')
+ pat = /ERROR WEBrick::HTTPStatus::Unauthorized/
+ assert_match(pat, log); log.sub!(pat, '')
+ assert_not_match(/ERROR/, log)
end
def test_basic_auth3
@@ -92,7 +97,7 @@ class TestWEBrickHTTPAuth < Test::Unit::TestCase
)/x
def test_digest_auth
- TestWEBrick.start_httpserver{|server, addr, port, log|
+ log = TestWEBrick.start_httpserver{|server, addr, port, log|
realm = "WEBrick's realm"
path = "/digest_auth"
@@ -143,6 +148,15 @@ class TestWEBrickHTTPAuth < Test::Unit::TestCase
end
}
}
+ pat = /ERROR Digest WEBrick's realm: no credentials in the request\./
+ assert_match(pat, log); log.sub!(pat, '')
+ pat = /ERROR WEBrick::HTTPStatus::Unauthorized/
+ assert_match(pat, log); log.sub!(pat, '')
+ pat = /ERROR Digest WEBrick's realm: webrick: digest unmatch\./
+ assert_match(pat, log); log.sub!(pat, '')
+ pat = /ERROR WEBrick::HTTPStatus::Unauthorized/
+ assert_match(pat, log); log.sub!(pat, '')
+ assert_not_match(/ERROR/, log)
end
private