mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2026-02-07 17:48:34 +00:00
test: add test with changing address order
This commit is contained in:
@ -18,6 +18,7 @@
|
||||
package fakeapi
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
@ -44,6 +45,15 @@ func (ctl *Controller) TurnInternetConnectionOn() {
|
||||
ctl.noInternetConnection = false
|
||||
}
|
||||
|
||||
func (ctl *Controller) ReorderAddresses(user *pmapi.User, addressIDs []string) error {
|
||||
api := ctl.getFakeAPIForUser(user.ID)
|
||||
if api == nil {
|
||||
return errors.New("no such user")
|
||||
}
|
||||
|
||||
return api.ReorderAddresses(addressIDs)
|
||||
}
|
||||
|
||||
func (ctl *Controller) AddUser(user *pmapi.User, addresses *pmapi.AddressList, password string, twoFAEnabled bool) error {
|
||||
ctl.usersByUsername[user.Name] = &fakeUser{
|
||||
user: user,
|
||||
@ -131,6 +141,15 @@ func (ctl *Controller) AddUserMessage(username string, message *pmapi.Message) e
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ctl *Controller) getFakeAPIForUser(userID string) *FakePMAPI {
|
||||
for _, fakeAPI := range ctl.fakeAPIs {
|
||||
if fakeAPI.userID == userID {
|
||||
return fakeAPI
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ctl *Controller) resetUsers() {
|
||||
for _, fakeAPI := range ctl.fakeAPIs {
|
||||
_ = fakeAPI.setUser(fakeAPI.username)
|
||||
|
||||
Reference in New Issue
Block a user