mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-24 02:46:44 +00:00
Fix setting flags
This commit is contained in:
@ -33,3 +33,13 @@ Feature: IMAP delete messages
|
||||
| Folders/mbox |
|
||||
| Labels/label |
|
||||
| Trash |
|
||||
|
||||
Scenario: Delete message by setting flags
|
||||
Given there are 1 messages in mailbox "INBOX" for "user"
|
||||
And there is IMAP client logged in as "user"
|
||||
And there is IMAP client selected in "INBOX"
|
||||
When IMAP client marks message "1" with "\Deleted"
|
||||
Then IMAP response is "OK"
|
||||
And mailbox "INBOX" for "user" has 0 messages
|
||||
# Unread because we set flags without \Seen.
|
||||
And message "1" in "Trash" for "user" is marked as unread
|
||||
|
||||
@ -2,6 +2,8 @@ Feature: IMAP move messages
|
||||
Background:
|
||||
Given there is connected user "user"
|
||||
And there is "user" with mailbox "Folders/mbox"
|
||||
# Messages are inserted in opposite way to keep increasing ID.
|
||||
# Sequence numbers are then opposite than listed above.
|
||||
And there are messages in mailbox "INBOX" for "user"
|
||||
| from | to | subject | body |
|
||||
| john.doe@mail.com | user@pm.me | foo | hello |
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Feature: IMAP search messages
|
||||
Background:
|
||||
Given there is connected user "user"
|
||||
# Messages are inserted in opposite way to keep increasing UID.
|
||||
# Messages are inserted in opposite way to keep increasing ID.
|
||||
# Sequence numbers are then opposite than listed above.
|
||||
Given there are messages in mailbox "INBOX" for "user"
|
||||
| from | to | cc | subject | read | starred | body |
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
Feature: IMAP update messages
|
||||
Background:
|
||||
Given there is connected user "user"
|
||||
# Messages are inserted in opposite way to keep increasing ID.
|
||||
# Sequence numbers are then opposite than listed above.
|
||||
And there are messages in mailbox "INBOX" for "user"
|
||||
| from | to | subject | body | read | starred |
|
||||
| john.doe@mail.com | user@pm.me | foo | hello | false | false |
|
||||
@ -33,3 +35,23 @@ Feature: IMAP update messages
|
||||
Then IMAP response is "OK"
|
||||
And message "2" in "INBOX" for "user" is marked as read
|
||||
And message "2" in "INBOX" for "user" is marked as unstarred
|
||||
|
||||
Scenario: Mark message as read and starred
|
||||
When IMAP client marks message "2" with "\Seen \Flagged"
|
||||
Then IMAP response is "OK"
|
||||
And message "1" in "INBOX" for "user" is marked as read
|
||||
And message "1" in "INBOX" for "user" is marked as starred
|
||||
|
||||
Scenario: Mark message as read only
|
||||
When IMAP client marks message "1" with "\Seen"
|
||||
Then IMAP response is "OK"
|
||||
And message "2" in "INBOX" for "user" is marked as read
|
||||
# Unstarred because we set flags without \Starred.
|
||||
And message "2" in "INBOX" for "user" is marked as unstarred
|
||||
|
||||
Scenario: Mark message as spam only
|
||||
When IMAP client marks message "1" with "Junk"
|
||||
Then IMAP response is "OK"
|
||||
# Unread and unstarred because we set flags without \Seen and \Starred.
|
||||
And message "1" in "Spam" for "user" is marked as unread
|
||||
And message "1" in "Spam" for "user" is marked as unstarred
|
||||
|
||||
@ -38,6 +38,8 @@ func IMAPActionsMessagesFeatureContext(s *godog.Suite) {
|
||||
s.Step(`^IMAP client creates message "([^"]*)" from "([^"]*)" to "([^"]*)" with body "([^"]*)" in "([^"]*)"$`, imapClientCreatesMessageFromToWithBody)
|
||||
s.Step(`^IMAP client creates message "([^"]*)" from "([^"]*)" to address "([^"]*)" of "([^"]*)" with body "([^"]*)" in "([^"]*)"$`, imapClientCreatesMessageFromToAddressOfUserWithBody)
|
||||
s.Step(`^IMAP client creates message "([^"]*)" from address "([^"]*)" of "([^"]*)" to "([^"]*)" with body "([^"]*)" in "([^"]*)"$`, imapClientCreatesMessageFromAddressOfUserToWithBody)
|
||||
s.Step(`^IMAP client marks message "([^"]*)" with "([^"]*)"$`, imapClientMarksMessageWithFlags)
|
||||
s.Step(`^IMAP client "([^"]*)" marks message "([^"]*)" with "([^"]*)"$`, imapClientNamedMarksMessageWithFlags)
|
||||
s.Step(`^IMAP client marks message "([^"]*)" as read$`, imapClientMarksMessageAsRead)
|
||||
s.Step(`^IMAP client "([^"]*)" marks message "([^"]*)" as read$`, imapClientNamedMarksMessageAsRead)
|
||||
s.Step(`^IMAP client marks message "([^"]*)" as unread$`, imapClientMarksMessageAsUnread)
|
||||
@ -138,6 +140,16 @@ func imapClientCreatesMessageFromAddressOfUserToWithBody(subject, bddAddressID,
|
||||
return imapClientCreatesMessageFromToWithBody(subject, account.Address(), to, body, mailboxName)
|
||||
}
|
||||
|
||||
func imapClientMarksMessageWithFlags(messageRange, flags string) error {
|
||||
return imapClientNamedMarksMessageWithFlags("imap", messageRange, flags)
|
||||
}
|
||||
|
||||
func imapClientNamedMarksMessageWithFlags(imapClient, messageRange, flags string) error {
|
||||
res := ctx.GetIMAPClient(imapClient).SetFlags(messageRange, flags)
|
||||
ctx.SetIMAPLastResponse(imapClient, res)
|
||||
return nil
|
||||
}
|
||||
|
||||
func imapClientMarksMessageAsRead(messageRange string) error {
|
||||
return imapClientNamedMarksMessageAsRead("imap", messageRange)
|
||||
}
|
||||
|
||||
@ -207,6 +207,10 @@ func (c *IMAPClient) MarkAsUnstarred(ids string) *IMAPResponse {
|
||||
return c.RemoveFlags(ids, "\\Flagged")
|
||||
}
|
||||
|
||||
func (c *IMAPClient) SetFlags(ids, flags string) *IMAPResponse {
|
||||
return c.changeFlags(ids, flags, "")
|
||||
}
|
||||
|
||||
func (c *IMAPClient) AddFlags(ids, flags string) *IMAPResponse {
|
||||
return c.changeFlags(ids, flags, "+")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user