From 93752280aaa1ec6b0ae39e97858e908dc78acd7a Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Wed, 2 Oct 2024 12:54:32 +0200 Subject: [PATCH] Update smtp_test.go to add more authentication test cases Enhanced the LoginAuth test coverage by adding new scenarios with different sequences and invalid cases. This ensures more robust validation and better handling of edge cases in authentication testing. --- smtp/smtp_test.go | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/smtp/smtp_test.go b/smtp/smtp_test.go index 6df6eeb..d5b02a7 100644 --- a/smtp/smtp_test.go +++ b/smtp/smtp_test.go @@ -57,10 +57,31 @@ var authTests = []authTest{ }, { LoginAuth("user", "pass", "testserver"), - []string{"Username:", "Password:", "User Name\x00", "Password\x00", "Invalid:"}, + []string{"Username:", "Password:"}, "LOGIN", - []string{"", "user", "pass", "user", "pass", ""}, - []bool{false, false, false, false, true}, + []string{"", "user", "pass"}, + []bool{false, false}, + }, + { + LoginAuth("user", "pass", "testserver"), + []string{"User Name\x00", "Password\x00"}, + "LOGIN", + []string{"", "user", "pass"}, + []bool{false, false}, + }, + { + LoginAuth("user", "pass", "testserver"), + []string{"Invalid", "Invalid:"}, + "LOGIN", + []string{"", "user", "pass"}, + []bool{false, false}, + }, + { + LoginAuth("user", "pass", "testserver"), + []string{"Invalid", "Invalid:", "Too many"}, + "LOGIN", + []string{"", "user", "pass", ""}, + []bool{false, false, true}, }, { CRAMMD5Auth("user", "pass"),