feat(GODT-1264): constraint on Scheduled mailbox in connector + Integration tests.

This commit is contained in:
Xavier Michelon
2023-02-15 07:37:09 +00:00
parent 13db1b0db8
commit 08dab2d115
8 changed files with 74 additions and 66 deletions

View File

@ -193,14 +193,6 @@ func (s *scenario) theAddressOfAccountHasTheFollowingMessagesInMailbox(address,
return err
}
var messageFlags proton.MessageFlag
if !strings.EqualFold(mailbox, "Sent") {
messageFlags = proton.MessageFlagReceived
} else {
messageFlags = proton.MessageFlagSent
}
return s.t.createMessages(ctx, username, addrID, xslices.Map(wantMessages, func(message Message) proton.ImportReq {
return proton.ImportReq{
@ -208,7 +200,7 @@ func (s *scenario) theAddressOfAccountHasTheFollowingMessagesInMailbox(address,
AddressID: addrID,
LabelIDs: []string{mboxID},
Unread: proton.Bool(message.Unread),
Flags: messageFlags,
Flags: flagsForMailbox(mailbox),
},
Message: message.Build(),
}
@ -228,7 +220,7 @@ func (s *scenario) theAddressOfAccountHasMessagesInMailbox(address, username str
Metadata: proton.ImportMetadata{
AddressID: addrID,
LabelIDs: []string{mboxID},
Flags: proton.MessageFlagReceived,
Flags: flagsForMailbox(mailbox),
},
Message: Message{
Subject: fmt.Sprintf("%d", idx),
@ -240,6 +232,18 @@ func (s *scenario) theAddressOfAccountHasMessagesInMailbox(address, username str
})))
}
func flagsForMailbox(mailboxName string) proton.MessageFlag {
if strings.EqualFold(mailboxName, "Sent") {
return proton.MessageFlagSent
}
if strings.EqualFold(mailboxName, "Scheduled") {
return proton.MessageFlagScheduledSend
}
return proton.MessageFlagReceived
}
// accountDraftChanged changes the draft attributes, where draftIndex is
// similar to sequential ID i.e. 1 represents the first message of draft folder
// sorted by API creation time.