Other: IMAP create duplicate mailbox tests

This commit is contained in:
James Houlahan
2022-10-25 00:07:47 +02:00
parent 94e219137e
commit b594b5f90a
5 changed files with 84 additions and 70 deletions

View File

@ -27,12 +27,9 @@ import (
"github.com/bradenaw/juniper/iterator"
"github.com/bradenaw/juniper/xslices"
"github.com/cucumber/godog"
"github.com/cucumber/messages-go/v16"
"github.com/emersion/go-imap"
id "github.com/emersion/go-imap-id"
"github.com/emersion/go-imap/client"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"golang.org/x/exp/slices"
)
@ -190,26 +187,6 @@ func (s *scenario) imapClientSeesTheFollowingMailboxInfoForMailbox(clientID, mai
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 {
_, client := s.t.getIMAPClient(clientID)