Skip to content

Commit

Permalink
add: test to get exception if certificate CN or SAN does not match th…
Browse files Browse the repository at this point in the history
…e expected OpenSSL hostname
  • Loading branch information
TomFreudenberg committed Jan 21, 2020
1 parent b80ba4f commit 97fb3cb
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/integration/invalid_certificate_name_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# frozen_string_literal: true

# Unit test to check commands without TCP
class InvalidCertificateNameIntegrationTest < BaseIntegrationTest

# initialize before tests
def setup
# create some message vars and sources
super
# create service instance
@smtpd = MidiSmtpServerTest.new(
'5555',
'127.0.0.1',
1,
do_dns_reverse_lookup: false,
auth_mode: :AUTH_OPTIONAL,
tls_mode: :TLS_REQUIRED,
tls_cert_cn: 'invalid.hostname',
pipelining_extension: false,
internationalization_extensions: true
)
# start the daemon to run real life integration tests
@smtpd.start
end

### TEST SUITE

def test_net_smtp_auth_login_and_simple_send_1_mail_with_ssl
assert_raises(OpenSSL::SSL::SSLError) { net_smtp_send_mail @envelope_mail_from, @envelope_rcpt_to, @doc_simple_mail, 'administrator', 'password', :login, true }
end

end

0 comments on commit 97fb3cb

Please sign in to comment.