From d720feaa6d994ba9947ae831d508af2d468d5946 Mon Sep 17 00:00:00 2001 From: Leander Beernaert Date: Thu, 5 Jan 2023 15:00:01 +0100 Subject: [PATCH] Other: Flag messages imported into "Sent" mailbox as Sent --- tests/user_test.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/user_test.go b/tests/user_test.go index 062e951b..4bce22a9 100644 --- a/tests/user_test.go +++ b/tests/user_test.go @@ -22,6 +22,7 @@ import ( "errors" "fmt" "net/mail" + "strings" "github.com/ProtonMail/go-proton-api" "github.com/ProtonMail/gopenpgp/v2/crypto" @@ -261,13 +262,22 @@ 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{ + Metadata: proton.ImportMetadata{ AddressID: addrID, LabelIDs: []string{mboxID}, Unread: proton.Bool(message.Unread), - Flags: proton.MessageFlagReceived, + Flags: messageFlags, }, Message: message.Build(), }