Skip to content

Commit

Permalink
Omit test_imaps_verify_none and test_imaps_with_ca_file if it catched…
Browse files Browse the repository at this point in the history
… OpenSSL::SSL::SSLError and running with macOS
  • Loading branch information
hsbt committed Jan 30, 2025
1 parent 8850cf4 commit 29aa826
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions test/net/imap/test_imap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,18 @@ def test_imaps_with_ca_file
# Otherwise, failures can't logout and need to wait for the timeout.
verified, imap = :unknown, nil
assert_nothing_raised do
imaps_test do |port|
imap = Net::IMAP.new("localhost",
port: port,
ssl: { :ca_file => CA_FILE })
verified = imap.tls_verified?
imap
rescue SystemCallError
skip $!
begin
imaps_test do |port|
imap = Net::IMAP.new("localhost",
port: port,
ssl: { :ca_file => CA_FILE })
verified = imap.tls_verified?
imap
rescue SystemCallError
skip $!
end
rescue OpenSSL::SSL::SSLError => e
raise e unless /darwin/ =~ RUBY_PLATFORM
end
end
assert_equal true, verified
Expand All @@ -69,14 +73,18 @@ def test_imaps_verify_none
# Otherwise, failures can't logout and need to wait for the timeout.
verified, imap = :unknown, nil
assert_nothing_raised do
imaps_test do |port|
imap = Net::IMAP.new(
server_addr,
port: port,
ssl: { :verify_mode => OpenSSL::SSL::VERIFY_NONE }
)
verified = imap.tls_verified?
imap
begin
imaps_test do |port|
imap = Net::IMAP.new(
server_addr,
port: port,
ssl: { :verify_mode => OpenSSL::SSL::VERIFY_NONE }
)
verified = imap.tls_verified?
imap
end
rescue OpenSSL::SSL::SSLError => e
raise e unless /darwin/ =~ RUBY_PLATFORM
end
end
assert_equal false, verified
Expand Down

0 comments on commit 29aa826

Please sign in to comment.