mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-18 08:06:59 +00:00
Other: Fix testCtx.getMBoxID()
Ensure we always translate the labels to their full name so they match properly on all commands.
This commit is contained in:
@ -263,7 +263,19 @@ func (t *testCtx) getMBoxID(userID string, name string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
idx := xslices.IndexFunc(labels, func(label proton.Label) bool {
|
idx := xslices.IndexFunc(labels, func(label proton.Label) bool {
|
||||||
return label.Name == name
|
var labelName string
|
||||||
|
switch label.Type {
|
||||||
|
case proton.LabelTypeSystem:
|
||||||
|
labelName = label.Name
|
||||||
|
case proton.LabelTypeFolder:
|
||||||
|
labelName = fmt.Sprintf("Folders/%v", label.Name)
|
||||||
|
case proton.LabelTypeLabel:
|
||||||
|
labelName = fmt.Sprintf("Labels/%v", label.Name)
|
||||||
|
case proton.LabelTypeContactGroup:
|
||||||
|
labelName = label.Name
|
||||||
|
}
|
||||||
|
|
||||||
|
return labelName == name
|
||||||
})
|
})
|
||||||
|
|
||||||
if idx < 0 {
|
if idx < 0 {
|
||||||
|
|||||||
@ -4,7 +4,7 @@ Feature: IMAP get mailbox info
|
|||||||
And the account "[user:user]" has the following custom mailboxes:
|
And the account "[user:user]" has the following custom mailboxes:
|
||||||
| name | type |
|
| name | type |
|
||||||
| one | folder |
|
| one | folder |
|
||||||
And the address "[user:user]@[domain]" of account "[user:user]" has the following messages in "one":
|
And the address "[user:user]@[domain]" of account "[user:user]" has the following messages in "Folders/one":
|
||||||
| from | to | subject | unread |
|
| from | to | subject | unread |
|
||||||
| a@example.com | a@example.com | one | true |
|
| a@example.com | a@example.com | one | true |
|
||||||
| b@example.com | b@example.com | two | false |
|
| b@example.com | b@example.com | two | false |
|
||||||
|
|||||||
@ -5,7 +5,7 @@ Feature: IMAP remove messages from mailbox
|
|||||||
| name | type |
|
| name | type |
|
||||||
| mbox | folder |
|
| mbox | folder |
|
||||||
| label | label |
|
| label | label |
|
||||||
And the address "[user:user]@[domain]" of account "[user:user]" has 10 messages in "mbox"
|
And the address "[user:user]@[domain]" of account "[user:user]" has 10 messages in "Folders/mbox"
|
||||||
And bridge starts
|
And bridge starts
|
||||||
And the user logs in with username "[user:user]" and password "password"
|
And the user logs in with username "[user:user]" and password "password"
|
||||||
And user "[user:user]" finishes syncing
|
And user "[user:user]" finishes syncing
|
||||||
|
|||||||
@ -6,11 +6,11 @@ Feature: Address mode
|
|||||||
| name | type |
|
| name | type |
|
||||||
| one | folder |
|
| one | folder |
|
||||||
| two | folder |
|
| two | folder |
|
||||||
And the address "[user:user]@[domain]" of account "[user:user]" has the following messages in "one":
|
And the address "[user:user]@[domain]" of account "[user:user]" has the following messages in "Folders/one":
|
||||||
| from | to | subject | unread |
|
| from | to | subject | unread |
|
||||||
| a@[domain] | a@[domain] | one | true |
|
| a@[domain] | a@[domain] | one | true |
|
||||||
| b@[domain] | b@[domain] | two | false |
|
| b@[domain] | b@[domain] | two | false |
|
||||||
And the address "[alias:alias]@[domain]" of account "[user:user]" has the following messages in "two":
|
And the address "[alias:alias]@[domain]" of account "[user:user]" has the following messages in "Folders/two":
|
||||||
| from | to | subject | unread |
|
| from | to | subject | unread |
|
||||||
| c@[domain] | c@[domain] | three | true |
|
| c@[domain] | c@[domain] | three | true |
|
||||||
| d@[domain] | d@[domain] | four | false |
|
| d@[domain] | d@[domain] | four | false |
|
||||||
|
|||||||
@ -6,11 +6,11 @@ Feature: Bridge can fully sync an account
|
|||||||
| one | folder |
|
| one | folder |
|
||||||
| two | folder |
|
| two | folder |
|
||||||
| three | label |
|
| three | label |
|
||||||
And the address "[user:user]@[domain]" of account "[user:user]" has the following messages in "one":
|
And the address "[user:user]@[domain]" of account "[user:user]" has the following messages in "Folders/one":
|
||||||
| from | to | subject | unread |
|
| from | to | subject | unread |
|
||||||
| a@[domain] | a@[domain] | one | true |
|
| a@[domain] | a@[domain] | one | true |
|
||||||
| b@[domain] | b@[domain] | two | false |
|
| b@[domain] | b@[domain] | two | false |
|
||||||
And the address "[user:user]@[domain]" of account "[user:user]" has the following messages in "two":
|
And the address "[user:user]@[domain]" of account "[user:user]" has the following messages in "Folders/two":
|
||||||
| from | to | subject | unread |
|
| from | to | subject | unread |
|
||||||
| a@[domain] | a@[domain] | one | true |
|
| a@[domain] | a@[domain] | one | true |
|
||||||
| b@[domain] | b@[domain] | two | false |
|
| b@[domain] | b@[domain] | two | false |
|
||||||
|
|||||||
Reference in New Issue
Block a user