"Fossies" - the Fresh Open Source Software Archive

Member "ruby-2.7.4/test/drb/test_drbssl.rb" (7 Jul 2021, 1374 Bytes) of package /linux/misc/ruby-2.7.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ruby source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "test_drbssl.rb": 2.7.3_vs_2.7.4.

    1 # frozen_string_literal: false
    2 require_relative 'drbtest'
    3 
    4 begin
    5   require 'drb/ssl'
    6 rescue LoadError
    7 end
    8 
    9 module DRbTests
   10 
   11 if Object.const_defined?("OpenSSL")
   12 
   13 
   14 class DRbSSLService < DRbService
   15   %w(ut_drb_drbssl.rb ut_array_drbssl.rb).each do |nm|
   16     add_service_command(nm)
   17   end
   18 
   19   def start
   20     config = Hash.new
   21 
   22     config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER
   23     config[:SSLVerifyCallback] = lambda{ |ok,x509_store|
   24       true
   25     }
   26     begin
   27       data = open("sample.key"){|io| io.read }
   28       config[:SSLPrivateKey] = OpenSSL::PKey::RSA.new(data)
   29       data = open("sample.crt"){|io| io.read }
   30       config[:SSLCertificate] = OpenSSL::X509::Certificate.new(data)
   31     rescue
   32       # $stderr.puts "Switching to use self-signed certificate"
   33       config[:SSLCertName] =
   34         [ ["C","JP"], ["O","Foo.DRuby.Org"], ["CN", "Sample"] ]
   35     end
   36 
   37     @server = DRb::DRbServer.new('drbssl://localhost:0', manager, config)
   38   end
   39 end
   40 
   41 class TestDRbSSLCore < Test::Unit::TestCase
   42   include DRbCore
   43   def setup
   44     @drb_service = DRbSSLService.new
   45     super
   46     setup_service 'ut_drb_drbssl.rb'
   47   end
   48 
   49   def test_02_unknown
   50   end
   51 
   52   def test_01_02_loop
   53   end
   54 
   55   def test_05_eq
   56   end
   57 end
   58 
   59 class TestDRbSSLAry < Test::Unit::TestCase
   60   include DRbAry
   61   def setup
   62     @drb_service = DRbSSLService.new
   63     super
   64     setup_service 'ut_array_drbssl.rb'
   65   end
   66 end
   67 
   68 
   69 end
   70 
   71 end