From 8545d2f4b9b72606894cfb9219f7554e13c63a90 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 7 May 2012 17:18:55 +0000 Subject: test_ssl.rb: test only if necessary option is available. * test/openssl/test_ssl.rb (test_forbid_tls_v1_{1,2}_{for_client,from_server}): test only if necessary option is available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/openssl/test_ssl.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb index 147d6df71c..c6e776714d 100644 --- a/test/openssl/test_ssl.rb +++ b/test/openssl/test_ssl.rb @@ -146,7 +146,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase client_ca_from_server = sslconn.client_ca [@cli_cert, @cli_key] end - server_connect(port, ctx) { |ssl| assert_equal([@ca], client_ca_from_server) } + server_connect(port, ctx) { |ssl| assert_equal([@ca], client_ca_from_server) } } end @@ -471,7 +471,7 @@ if OpenSSL::SSL::SSLContext::METHODS.include? :TLSv1_2 ctx.ssl_version = :TLSv1_1 assert_raise(OpenSSL::SSL::SSLError) { server_connect(port, ctx) } } - end + end if defined?(OpenSSL::SSL::OP_NO_TLSv1_1) def test_forbid_tls_v1_1_from_server start_server_version(:TLSv1_1) { |server, port| @@ -479,7 +479,7 @@ if OpenSSL::SSL::SSLContext::METHODS.include? :TLSv1_2 ctx.options = OpenSSL::SSL::OP_ALL | OpenSSL::SSL::OP_NO_TLSv1_1 assert_raise(OpenSSL::SSL::SSLError) { server_connect(port, ctx) } } - end + end if defined?(OpenSSL::SSL::OP_NO_TLSv1_1) def test_forbid_tls_v1_2_for_client ctx_proc = Proc.new { |ctx| ctx.options = OpenSSL::SSL::OP_ALL | OpenSSL::SSL::OP_NO_TLSv1_2 } @@ -488,7 +488,7 @@ if OpenSSL::SSL::SSLContext::METHODS.include? :TLSv1_2 ctx.ssl_version = :TLSv1_2 assert_raise(OpenSSL::SSL::SSLError) { server_connect(port, ctx) } } - end + end if defined?(OpenSSL::SSL::OP_NO_TLSv1_2) def test_forbid_tls_v1_2_from_server start_server_version(:TLSv1_2) { |server, port| @@ -496,14 +496,14 @@ if OpenSSL::SSL::SSLContext::METHODS.include? :TLSv1_2 ctx.options = OpenSSL::SSL::OP_ALL | OpenSSL::SSL::OP_NO_TLSv1_2 assert_raise(OpenSSL::SSL::SSLError) { server_connect(port, ctx) } } - end + end if defined?(OpenSSL::SSL::OP_NO_TLSv1_2) end private def start_server_version(version, ctx_proc=nil, &blk) - ctx_wrap = Proc.new { |ctx| + ctx_wrap = Proc.new { |ctx| ctx.ssl_version = version ctx_proc.call(ctx) if ctx_proc } -- cgit v1.2.3