Add additional SSL and TLS tests in client_test.go

Enhanced the unit tests in client_test.go by adding more test cases for SSL Port and TLS Port Policy. These additions contribute to more effective coverage of edge cases and increase the robustness of the test suite.
This commit is contained in:
Winni Neessen 2024-01-25 16:56:15 +01:00
parent 80893bd27a
commit 4a90c2de62
Signed by: wneessen
GPG key ID: 5F3AF39B820C119D

View file

@ -89,9 +89,12 @@ func TestNewClientWithOptions(t *testing.T) {
{"WithTimeout()", WithTimeout(time.Second * 5), false}, {"WithTimeout()", WithTimeout(time.Second * 5), false},
{"WithTimeout()", WithTimeout(-10), true}, {"WithTimeout()", WithTimeout(-10), true},
{"WithSSL()", WithSSL(), false}, {"WithSSL()", WithSSL(), false},
{"WithSSLPort(false)", WithSSLPort(false), false},
{"WithSSLPort(true)", WithSSLPort(true), false},
{"WithHELO()", WithHELO(host), false}, {"WithHELO()", WithHELO(host), false},
{"WithHELO(); helo is empty", WithHELO(""), true}, {"WithHELO(); helo is empty", WithHELO(""), true},
{"WithTLSPolicy()", WithTLSPolicy(TLSOpportunistic), false}, {"WithTLSPolicy()", WithTLSPolicy(TLSOpportunistic), false},
{"WithTLSPortPolicy()", WithTLSPortPolicy(TLSOpportunistic), false},
{"WithTLSConfig()", WithTLSConfig(&tls.Config{}), false}, {"WithTLSConfig()", WithTLSConfig(&tls.Config{}), false},
{"WithTLSConfig(); config is nil", WithTLSConfig(nil), true}, {"WithTLSConfig(); config is nil", WithTLSConfig(nil), true},
{"WithSMTPAuth()", WithSMTPAuth(SMTPAuthLogin), false}, {"WithSMTPAuth()", WithSMTPAuth(SMTPAuthLogin), false},