test: add test with changing address order

This commit is contained in:
James Houlahan
2020-05-06 09:57:34 +02:00
parent c61e8bdc71
commit 2d200f6f8c
19 changed files with 202 additions and 23 deletions

View File

@ -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)
}