From cf1246d9eafb860c592b2a46dc4a9b41b57e3ada Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Wed, 23 Oct 2024 23:34:13 +0200 Subject: [PATCH] Remove redundant DialWithContext test cases Deleted two test functions for DialWithContext that tested invalid HELO and authentication scenarios. These tests were deemed redundant as the error handling for these cases is covered elsewhere. --- client_test.go | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/client_test.go b/client_test.go index 288156c..4725310 100644 --- a/client_test.go +++ b/client_test.go @@ -1930,38 +1930,6 @@ func TestClient_DialWithContext(t *testing.T) { -// TestClient_DialWithContextInvalidHELO tests the DialWithContext method with intentional breaking -// for the Client object -func TestClient_DialWithContextInvalidHELO(t *testing.T) { - c, err := getTestConnection(true) - if err != nil { - t.Skipf("failed to create test client: %s. Skipping tests", err) - } - c.helo = "" - ctx := context.Background() - if err = c.DialWithContext(ctx); err == nil { - t.Errorf("dial succeeded but was supposed to fail") - return - } -} - -// TestClient_DialWithContextInvalidAuth tests the DialWithContext method with intentional breaking -// for the Client object -func TestClient_DialWithContextInvalidAuth(t *testing.T) { - c, err := getTestConnection(true) - if err != nil { - t.Skipf("failed to create test client: %s. Skipping tests", err) - } - c.user = "invalid" - c.pass = "invalid" - c.SetSMTPAuthCustom(smtp.LoginAuth("invalid", "invalid", "invalid", false)) - ctx := context.Background() - if err = c.DialWithContext(ctx); err == nil { - t.Errorf("dial succeeded but was supposed to fail") - return - } -} - // TestClient_checkConn tests the checkConn method with intentional breaking for the Client object func TestClient_checkConn(t *testing.T) { c, err := getTestConnection(true)