From 8402657108f39553c684175bf693d0919cd51d69 Mon Sep 17 00:00:00 2001 From: Romain Le Jeune Date: Fri, 29 Sep 2023 08:35:41 +0000 Subject: [PATCH] fix(GODT-2968): use proper base64 encoded string even for bad password test. --- tests/imap_test.go | 5 +++-- tests/smtp_test.go | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/imap_test.go b/tests/imap_test.go index 4165984f..8138a9c9 100644 --- a/tests/imap_test.go +++ b/tests/imap_test.go @@ -19,6 +19,7 @@ package tests import ( "bytes" + "encoding/base64" "encoding/json" "fmt" "io" @@ -118,8 +119,8 @@ func (s *scenario) imapClientCannotAuthenticateWithIncorrectUsername(clientID st func (s *scenario) imapClientCannotAuthenticateWithIncorrectPassword(clientID string) error { userID, client := s.t.getIMAPClient(clientID) - - if err := client.Login(s.t.getUserByID(userID).getEmails()[0], s.t.getUserByID(userID).getBridgePass()+"bad"); err == nil { + badPass := base64.StdEncoding.EncodeToString([]byte("bad_password")) + if err := client.Login(s.t.getUserByID(userID).getEmails()[0], badPass); err == nil { return fmt.Errorf("expected error, got nil") } diff --git a/tests/smtp_test.go b/tests/smtp_test.go index c5d48f66..4a986837 100644 --- a/tests/smtp_test.go +++ b/tests/smtp_test.go @@ -18,6 +18,7 @@ package tests import ( + "encoding/base64" "fmt" "net/smtp" "os" @@ -84,8 +85,8 @@ func (s *scenario) smtpClientCannotAuthenticateWithIncorrectUsername(clientID st func (s *scenario) smtpClientCannotAuthenticateWithIncorrectPassword(clientID string) error { userID, client := s.t.getSMTPClient(clientID) - - if err := client.Auth(smtp.PlainAuth("", s.t.getUserByID(userID).getEmails()[0], s.t.getUserByID(userID).getBridgePass()+"bad", constants.Host)); err == nil { + badPass := base64.StdEncoding.EncodeToString([]byte("bad_password")) + if err := client.Auth(smtp.PlainAuth("", s.t.getUserByID(userID).getEmails()[0], badPass, constants.Host)); err == nil { return fmt.Errorf("expected error, got nil") }