fix(GODT-2968): use proper base64 encoded string even for bad password test.

This commit is contained in:
Romain Le Jeune 2023-09-29 08:35:41 +00:00
parent 8a6f96f9f2
commit 8402657108
2 changed files with 6 additions and 4 deletions

View File

@ -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")
}

View File

@ -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")
}