mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-17 23:56:56 +00:00
Implement new SearchCriteria from latest go-imap
This commit is contained in:
@ -2,28 +2,79 @@ Feature: IMAP search messages
|
||||
Background:
|
||||
Given there is connected user "user"
|
||||
Given there are messages in mailbox "INBOX" for "user"
|
||||
| from | to | subject | body |
|
||||
| john.doe@mail.com | user@pm.me | foo | hello |
|
||||
| jane.doe@mail.com | name@pm.me | bar | world |
|
||||
| from | to | cc | subject | read | starred | body |
|
||||
| john.doe@email.com | user@pm.me | | foo | false | false | hello |
|
||||
| jane.doe@email.com | user@pm.me | name@pm.me | bar | true | true | world |
|
||||
| jane.doe@email.com | name@pm.me | | baz | true | false | bye |
|
||||
And there is IMAP client logged in as "user"
|
||||
And there is IMAP client selected in "INBOX"
|
||||
|
||||
Scenario: Search by subject
|
||||
Scenario: Search by Sequence numbers
|
||||
When IMAP client searches for "1"
|
||||
Then IMAP response is "OK"
|
||||
And IMAP response contains "SEARCH 1[^0-9]*$"
|
||||
|
||||
Scenario: Search by UID
|
||||
When IMAP client searches for "UID 2"
|
||||
Then IMAP response is "OK"
|
||||
And IMAP response contains "SEARCH 2[^0-9]*$"
|
||||
|
||||
Scenario: Search by Sequence numbers and UID
|
||||
When IMAP client searches for "1 UID 1"
|
||||
Then IMAP response is "OK"
|
||||
And IMAP response contains "SEARCH 1[^0-9]*$"
|
||||
|
||||
Scenario: Search by Sequence numbers and UID without match
|
||||
When IMAP client searches for "1 UID 2"
|
||||
Then IMAP response is "OK"
|
||||
And IMAP response contains "SEARCH[^0-9]*$"
|
||||
|
||||
Scenario: Search by Subject
|
||||
When IMAP client searches for "SUBJECT foo"
|
||||
Then IMAP response is "OK"
|
||||
And IMAP response has 1 message
|
||||
And IMAP response contains "SEARCH 3[^0-9]*$"
|
||||
|
||||
Scenario: Search by text
|
||||
When IMAP client searches for "TEXT world"
|
||||
Then IMAP response is "OK"
|
||||
And IMAP response has 1 message
|
||||
|
||||
Scenario: Search by from
|
||||
Scenario: Search by From
|
||||
When IMAP client searches for "FROM jane.doe@email.com"
|
||||
Then IMAP response is "OK"
|
||||
And IMAP response has 1 message
|
||||
And IMAP response contains "SEARCH 1 2[^0-9]*$"
|
||||
|
||||
Scenario: Search by to
|
||||
Scenario: Search by To
|
||||
When IMAP client searches for "TO user@pm.me"
|
||||
Then IMAP response is "OK"
|
||||
And IMAP response has 1 message
|
||||
And IMAP response contains "SEARCH 2 3[^0-9]*$"
|
||||
|
||||
Scenario: Search by CC
|
||||
When IMAP client searches for "CC name@pm.me"
|
||||
Then IMAP response is "OK"
|
||||
And IMAP response contains "SEARCH 2[^0-9]*$"
|
||||
|
||||
Scenario: Search flagged messages
|
||||
When IMAP client searches for "FLAGGED"
|
||||
Then IMAP response is "OK"
|
||||
And IMAP response contains "SEARCH 2[^0-9]*$"
|
||||
|
||||
Scenario: Search not flagged messages
|
||||
When IMAP client searches for "UNFLAGGED"
|
||||
Then IMAP response is "OK"
|
||||
And IMAP response contains "SEARCH 1 3[^0-9]*$"
|
||||
|
||||
Scenario: Search seen messages
|
||||
When IMAP client searches for "SEEN"
|
||||
Then IMAP response is "OK"
|
||||
And IMAP response contains "SEARCH 1 2[^0-9]*$"
|
||||
|
||||
Scenario: Search unseen messages
|
||||
When IMAP client searches for "UNSEEN"
|
||||
Then IMAP response is "OK"
|
||||
And IMAP response contains "SEARCH 3[^0-9]*$"
|
||||
|
||||
Scenario: Search recent messages
|
||||
When IMAP client searches for "RECENT"
|
||||
Then IMAP response is "OK"
|
||||
And IMAP response contains "SEARCH 1 2 3[^0-9]*$"
|
||||
|
||||
Scenario: Search by more criterias
|
||||
When IMAP client searches for "SUBJECT baz TO name@pm.me SEEN UNFLAGGED"
|
||||
Then IMAP response is "OK"
|
||||
And IMAP response contains "SEARCH 1[^0-9]*$"
|
||||
|
||||
@ -97,6 +97,11 @@ func thereAreMessagesInMailboxesForAddressOfUser(mailboxNames, bddAddressID, bdd
|
||||
message.ToList = []*mail.Address{{
|
||||
Address: ctx.EnsureAddress(account.Username(), cell.Value),
|
||||
}}
|
||||
case "cc":
|
||||
message.AddressID = ctx.EnsureAddressID(account.Username(), cell.Value)
|
||||
message.CCList = []*mail.Address{{
|
||||
Address: ctx.EnsureAddress(account.Username(), cell.Value),
|
||||
}}
|
||||
case "subject":
|
||||
message.Subject = cell.Value
|
||||
case "body":
|
||||
|
||||
Reference in New Issue
Block a user