mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 12:46:46 +00:00
Other: IMAP create duplicate mailbox tests
This commit is contained in:
@ -154,7 +154,6 @@ func TestFeatures(testingT *testing.T) {
|
|||||||
ctx.Step(`^IMAP client "([^"]*)" sees the following mailbox info:$`, s.imapClientSeesTheFollowingMailboxInfo)
|
ctx.Step(`^IMAP client "([^"]*)" sees the following mailbox info:$`, s.imapClientSeesTheFollowingMailboxInfo)
|
||||||
ctx.Step(`^IMAP client "([^"]*)" eventually sees the following mailbox info:$`, s.imapClientEventuallySeesTheFollowingMailboxInfo)
|
ctx.Step(`^IMAP client "([^"]*)" eventually sees the following mailbox info:$`, s.imapClientEventuallySeesTheFollowingMailboxInfo)
|
||||||
ctx.Step(`^IMAP client "([^"]*)" sees the following mailbox info for "([^"]*)":$`, s.imapClientSeesTheFollowingMailboxInfoForMailbox)
|
ctx.Step(`^IMAP client "([^"]*)" sees the following mailbox info for "([^"]*)":$`, s.imapClientSeesTheFollowingMailboxInfoForMailbox)
|
||||||
ctx.Step(`^IMAP client "([^"]*)" sees the following mailboxes:$`, s.imapClientSeesTheFollowingMailboxes)
|
|
||||||
ctx.Step(`^IMAP client "([^"]*)" sees "([^"]*)"$`, s.imapClientSeesMailbox)
|
ctx.Step(`^IMAP client "([^"]*)" sees "([^"]*)"$`, s.imapClientSeesMailbox)
|
||||||
ctx.Step(`^IMAP client "([^"]*)" does not see "([^"]*)"$`, s.imapClientDoesNotSeeMailbox)
|
ctx.Step(`^IMAP client "([^"]*)" does not see "([^"]*)"$`, s.imapClientDoesNotSeeMailbox)
|
||||||
ctx.Step(`^IMAP client "([^"]*)" counts (\d+) mailboxes under "([^"]*)"$`, s.imapClientCountsMailboxesUnder)
|
ctx.Step(`^IMAP client "([^"]*)" counts (\d+) mailboxes under "([^"]*)"$`, s.imapClientCountsMailboxesUnder)
|
||||||
|
|||||||
@ -1,6 +1,12 @@
|
|||||||
Feature: IMAP create mailbox
|
Feature: IMAP create mailbox
|
||||||
Background:
|
Background:
|
||||||
Given there exists an account with username "user@pm.me" and password "password"
|
Given there exists an account with username "user@pm.me" and password "password"
|
||||||
|
And the account "user@pm.me" has the following custom mailboxes:
|
||||||
|
| name | type |
|
||||||
|
| f1 | folder |
|
||||||
|
| f2 | folder |
|
||||||
|
| l1 | label |
|
||||||
|
| l2 | label |
|
||||||
And bridge starts
|
And bridge starts
|
||||||
And the user logs in with username "user@pm.me" and password "password"
|
And the user logs in with username "user@pm.me" and password "password"
|
||||||
And user "user@pm.me" finishes syncing
|
And user "user@pm.me" finishes syncing
|
||||||
@ -12,4 +18,36 @@ Feature: IMAP create mailbox
|
|||||||
|
|
||||||
Scenario: Create label
|
Scenario: Create label
|
||||||
When IMAP client "1" creates "Labels/mbox"
|
When IMAP client "1" creates "Labels/mbox"
|
||||||
Then IMAP client "1" sees "Labels/mbox"
|
Then IMAP client "1" sees "Labels/mbox"
|
||||||
|
|
||||||
|
Scenario: Creating folder or label with existing name is not possible
|
||||||
|
When IMAP client "1" creates "Folders/f1"
|
||||||
|
Then it fails
|
||||||
|
When IMAP client "1" creates "Folders/f2"
|
||||||
|
Then it fails
|
||||||
|
When IMAP client "1" creates "Labels/l1"
|
||||||
|
Then it fails
|
||||||
|
When IMAP client "1" creates "Labels/l2"
|
||||||
|
Then it fails
|
||||||
|
When IMAP client "1" creates "Folders/f3"
|
||||||
|
Then it succeeds
|
||||||
|
When IMAP client "1" creates "Labels/l3"
|
||||||
|
Then it succeeds
|
||||||
|
Then IMAP client "1" sees the following mailbox info:
|
||||||
|
| name |
|
||||||
|
| INBOX |
|
||||||
|
| Drafts |
|
||||||
|
| Sent |
|
||||||
|
| Starred |
|
||||||
|
| Archive |
|
||||||
|
| Spam |
|
||||||
|
| Trash |
|
||||||
|
| All Mail |
|
||||||
|
| Folders |
|
||||||
|
| Folders/f1 |
|
||||||
|
| Folders/f2 |
|
||||||
|
| Folders/f3 |
|
||||||
|
| Labels |
|
||||||
|
| Labels/l1 |
|
||||||
|
| Labels/l2 |
|
||||||
|
| Labels/l3 |
|
||||||
@ -8,39 +8,39 @@ Feature: IMAP Hide All Mail
|
|||||||
|
|
||||||
Scenario: Hide All Mail Mailbox
|
Scenario: Hide All Mail Mailbox
|
||||||
Given IMAP client "1" sees the following mailbox info:
|
Given IMAP client "1" sees the following mailbox info:
|
||||||
| name | total | unread |
|
| name |
|
||||||
| INBOX | 0 | 0 |
|
| INBOX |
|
||||||
| Drafts | 0 | 0 |
|
| Drafts |
|
||||||
| Sent | 0 | 0 |
|
| Sent |
|
||||||
| Starred | 0 | 0 |
|
| Starred |
|
||||||
| Archive | 0 | 0 |
|
| Archive |
|
||||||
| Spam | 0 | 0 |
|
| Spam |
|
||||||
| Trash | 0 | 0 |
|
| Trash |
|
||||||
| All Mail | 0 | 0 |
|
| All Mail |
|
||||||
| Folders | 0 | 0 |
|
| Folders |
|
||||||
| Labels | 0 | 0 |
|
| Labels |
|
||||||
When bridge hides all mail
|
When bridge hides all mail
|
||||||
Then IMAP client "1" sees the following mailbox info:
|
Then IMAP client "1" sees the following mailbox info:
|
||||||
| name | total | unread |
|
| name |
|
||||||
| INBOX | 0 | 0 |
|
| INBOX |
|
||||||
| Drafts | 0 | 0 |
|
| Drafts |
|
||||||
| Sent | 0 | 0 |
|
| Sent |
|
||||||
| Starred | 0 | 0 |
|
| Starred |
|
||||||
| Archive | 0 | 0 |
|
| Archive |
|
||||||
| Spam | 0 | 0 |
|
| Spam |
|
||||||
| Trash | 0 | 0 |
|
| Trash |
|
||||||
| Folders | 0 | 0 |
|
| Folders |
|
||||||
| Labels | 0 | 0 |
|
| Labels |
|
||||||
When bridge shows all mail
|
When bridge shows all mail
|
||||||
Then IMAP client "1" sees the following mailbox info:
|
Then IMAP client "1" sees the following mailbox info:
|
||||||
| name | total | unread |
|
| name |
|
||||||
| INBOX | 0 | 0 |
|
| INBOX |
|
||||||
| Drafts | 0 | 0 |
|
| Drafts |
|
||||||
| Sent | 0 | 0 |
|
| Sent |
|
||||||
| Starred | 0 | 0 |
|
| Starred |
|
||||||
| Archive | 0 | 0 |
|
| Archive |
|
||||||
| Spam | 0 | 0 |
|
| Spam |
|
||||||
| Trash | 0 | 0 |
|
| Trash |
|
||||||
| All Mail | 0 | 0 |
|
| All Mail |
|
||||||
| Folders | 0 | 0 |
|
| Folders |
|
||||||
| Labels | 0 | 0 |
|
| Labels |
|
||||||
|
|||||||
@ -10,19 +10,19 @@ Feature: IMAP list mailboxes
|
|||||||
And user "user@pm.me" finishes syncing
|
And user "user@pm.me" finishes syncing
|
||||||
And user "user@pm.me" connects and authenticates IMAP client "1"
|
And user "user@pm.me" connects and authenticates IMAP client "1"
|
||||||
Then IMAP client "1" sees the following mailbox info:
|
Then IMAP client "1" sees the following mailbox info:
|
||||||
| name | total | unread |
|
| name |
|
||||||
| INBOX | 0 | 0 |
|
| INBOX |
|
||||||
| Drafts | 0 | 0 |
|
| Drafts |
|
||||||
| Sent | 0 | 0 |
|
| Sent |
|
||||||
| Starred | 0 | 0 |
|
| Starred |
|
||||||
| Archive | 0 | 0 |
|
| Archive |
|
||||||
| Spam | 0 | 0 |
|
| Spam |
|
||||||
| Trash | 0 | 0 |
|
| Trash |
|
||||||
| All Mail | 0 | 0 |
|
| All Mail |
|
||||||
| Folders | 0 | 0 |
|
| Folders |
|
||||||
| Folders/mbox1 | 0 | 0 |
|
| Folders/mbox1 |
|
||||||
| Labels | 0 | 0 |
|
| Labels |
|
||||||
| Labels/mbox2 | 0 | 0 |
|
| Labels/mbox2 |
|
||||||
|
|
||||||
Scenario: List multiple times in parallel without crash
|
Scenario: List multiple times in parallel without crash
|
||||||
Given there exists an account with username "user@pm.me" and password "password"
|
Given there exists an account with username "user@pm.me" and password "password"
|
||||||
|
|||||||
@ -27,12 +27,9 @@ import (
|
|||||||
"github.com/bradenaw/juniper/iterator"
|
"github.com/bradenaw/juniper/iterator"
|
||||||
"github.com/bradenaw/juniper/xslices"
|
"github.com/bradenaw/juniper/xslices"
|
||||||
"github.com/cucumber/godog"
|
"github.com/cucumber/godog"
|
||||||
"github.com/cucumber/messages-go/v16"
|
|
||||||
"github.com/emersion/go-imap"
|
"github.com/emersion/go-imap"
|
||||||
id "github.com/emersion/go-imap-id"
|
id "github.com/emersion/go-imap-id"
|
||||||
"github.com/emersion/go-imap/client"
|
"github.com/emersion/go-imap/client"
|
||||||
"github.com/google/go-cmp/cmp"
|
|
||||||
"github.com/google/go-cmp/cmp/cmpopts"
|
|
||||||
"golang.org/x/exp/slices"
|
"golang.org/x/exp/slices"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -190,26 +187,6 @@ func (s *scenario) imapClientSeesTheFollowingMailboxInfoForMailbox(clientID, mai
|
|||||||
return matchMailboxes(haveMailboxes, wantMailboxes)
|
return matchMailboxes(haveMailboxes, wantMailboxes)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *scenario) imapClientSeesTheFollowingMailboxes(clientID string, table *godog.Table) error {
|
|
||||||
_, client := s.t.getIMAPClient(clientID)
|
|
||||||
|
|
||||||
mailboxes := clientList(client)
|
|
||||||
|
|
||||||
have := xslices.Map(mailboxes, func(info *imap.MailboxInfo) string {
|
|
||||||
return info.Name
|
|
||||||
})
|
|
||||||
|
|
||||||
want := xslices.Map(table.Rows[1:], func(row *messages.PickleTableRow) string {
|
|
||||||
return row.Cells[0].Value
|
|
||||||
})
|
|
||||||
|
|
||||||
if !cmp.Equal(want, have, cmpopts.SortSlices(func(a, b string) bool { return a < b })) {
|
|
||||||
return fmt.Errorf("want %v, have %v", want, have)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *scenario) imapClientSeesMailbox(clientID, mailbox string) error {
|
func (s *scenario) imapClientSeesMailbox(clientID, mailbox string) error {
|
||||||
_, client := s.t.getIMAPClient(clientID)
|
_, client := s.t.getIMAPClient(clientID)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user