mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
GODT-1817: Restore old date message feature test + fix
This patch also fixes the message builder to not override other headers that already exist to avoid overriding sanitized header entries.
This commit is contained in:
@ -27,6 +27,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/ProtonMail/gluon/rfc822"
|
||||
"github.com/bradenaw/juniper/iterator"
|
||||
"github.com/bradenaw/juniper/xslices"
|
||||
"github.com/cucumber/godog"
|
||||
@ -503,6 +504,39 @@ func (s *scenario) imapClientsMoveMessageSeqOfUserFromToByOrderedOperations(sour
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *scenario) imapClientSeesHeaderInMessageWithSubject(clientID, headerString, subject, mailbox string) error {
|
||||
_, client := s.t.getIMAPClient(clientID)
|
||||
|
||||
messages, err := clientFetch(client, mailbox)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
section, err := imap.ParseBodySectionName("BODY[]")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, m := range messages {
|
||||
if m.Envelope.Subject == subject {
|
||||
literal, err := io.ReadAll(m.GetBody(section))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
header, _ := rfc822.Split(literal)
|
||||
|
||||
if !bytes.Contains(header, []byte(headerString)) {
|
||||
return fmt.Errorf("message header does not contain '%v'", headerString)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("could not find message with given subject '%v'", subject)
|
||||
}
|
||||
|
||||
func clientList(client *client.Client) []*imap.MailboxInfo {
|
||||
resCh := make(chan *imap.MailboxInfo)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user