mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/net/http/test_https.rb: As always, localhost is not
guaranteed to be resolved as 127.0.0.1. But a SSL certificate needs a socket to listen on a specific address where a CN resolves to. On situations where localhost is not 127.0.0.1, these tests are not possible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
39ac0609d5
commit
93fba33b47
2 changed files with 19 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
|||
Mon Sep 27 15:54:03 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
|
||||
|
||||
* test/net/http/test_https.rb: As always, localhost is not
|
||||
guaranteed to be resolved as 127.0.0.1. But a SSL
|
||||
certificate needs a socket to listen on a specific address
|
||||
where a CN resolves to. On situations where localhost is
|
||||
not 127.0.0.1, these tests are not possible.
|
||||
|
||||
Mon Sep 27 15:25:05 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
|
||||
|
||||
* test/net/imap/test_imap.rb: resurrection of r29259.
|
||||
|
|
|
@ -40,6 +40,8 @@ class TestNetHTTPS < Test::Unit::TestCase
|
|||
http.request_get("/") {|res|
|
||||
assert_equal($test_net_http_data, res.body)
|
||||
}
|
||||
rescue SystemCallError
|
||||
skip $!
|
||||
end
|
||||
|
||||
def test_post
|
||||
|
@ -52,6 +54,8 @@ class TestNetHTTPS < Test::Unit::TestCase
|
|||
http.request_post("/", data) {|res|
|
||||
assert_equal(data, res.body)
|
||||
}
|
||||
rescue SystemCallError
|
||||
skip $!
|
||||
end
|
||||
|
||||
if ENV["RUBY_OPENSSL_TEST_ALL"]
|
||||
|
@ -72,13 +76,19 @@ class TestNetHTTPS < Test::Unit::TestCase
|
|||
http.request_get("/") {|res|
|
||||
assert_equal($test_net_http_data, res.body)
|
||||
}
|
||||
rescue SystemCallError
|
||||
skip $!
|
||||
end
|
||||
|
||||
def test_certificate_verify_failure
|
||||
http = Net::HTTP.new("localhost", config("port"))
|
||||
http.use_ssl = true
|
||||
ex = assert_raise(OpenSSL::SSL::SSLError){
|
||||
http.request_get("/") {|res| }
|
||||
begin
|
||||
http.request_get("/") {|res| }
|
||||
rescue SystemCallError
|
||||
skip $!
|
||||
end
|
||||
}
|
||||
assert_match(/certificate verify failed/, ex.message)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue