mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-17 23:56:56 +00:00
test: add test with changing address order
This commit is contained in:
@ -24,7 +24,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func cleanup(client pmapi.Client) error {
|
||||
func cleanup(client pmapi.Client, addresses *pmapi.AddressList) error {
|
||||
if err := cleanSystemFolders(client); err != nil {
|
||||
return errors.Wrap(err, "failed to clean system folders")
|
||||
}
|
||||
@ -34,6 +34,9 @@ func cleanup(client pmapi.Client) error {
|
||||
if err := cleanTrash(client); err != nil {
|
||||
return errors.Wrap(err, "failed to clean trash")
|
||||
}
|
||||
if err := reorderAddresses(client, addresses); err != nil {
|
||||
return errors.Wrap(err, "failed to clean trash")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -130,3 +133,13 @@ func emptyFolder(client pmapi.Client, labelID string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func reorderAddresses(client pmapi.Client, addresses *pmapi.AddressList) error {
|
||||
addressIDs := []string{}
|
||||
|
||||
for _, address := range *addresses {
|
||||
addressIDs = append(addressIDs, address.ID)
|
||||
}
|
||||
|
||||
return client.ReorderAddresses(addressIDs)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user