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:
@ -146,6 +146,10 @@ func (a *TestAccount) AddressID() string {
|
||||
return a.addressToBeUsed.ID
|
||||
}
|
||||
|
||||
func (a *TestAccount) GetAddressID(addressTestID string) string {
|
||||
return a.addressesByBDDAddressID[addressTestID].ID
|
||||
}
|
||||
|
||||
// EnsureAddressID accepts address (simply the address) or bddAddressID used
|
||||
// in tests (in format [bddAddressID]) and returns always the real address ID.
|
||||
// If the address is not found, the ID of main address is returned.
|
||||
@ -163,6 +167,10 @@ func (a *TestAccount) EnsureAddressID(addressOrAddressTestID string) string {
|
||||
return a.AddressID()
|
||||
}
|
||||
|
||||
func (a *TestAccount) GetAddress(addressTestID string) string {
|
||||
return a.addressesByBDDAddressID[addressTestID].Email
|
||||
}
|
||||
|
||||
// EnsureAddress accepts address (simply the address) or bddAddressID used
|
||||
// in tests (in format [bddAddressID]) and returns always the address.
|
||||
// If the address ID cannot be found, the original value is returned.
|
||||
|
||||
@ -55,7 +55,8 @@ func (a *TestAccounts) GetTestAccount(username string) *TestAccount {
|
||||
return a.GetTestAccountWithAddress(username, "")
|
||||
}
|
||||
|
||||
func (a *TestAccounts) GetTestAccountWithAddress(username, addressID string) *TestAccount {
|
||||
// GetTestAccount returns the test account with the given username configured to use the given bddAddressID.
|
||||
func (a *TestAccounts) GetTestAccountWithAddress(username, bddAddressID string) *TestAccount {
|
||||
// Do lookup by full address and convert to name in tests.
|
||||
// Used by getting real data to ensure correct address or address ID.
|
||||
for key, user := range a.Users {
|
||||
@ -71,7 +72,7 @@ func (a *TestAccounts) GetTestAccountWithAddress(username, addressID string) *Te
|
||||
return newTestAccount(
|
||||
user,
|
||||
a.Addresses[user.Name],
|
||||
addressID,
|
||||
bddAddressID,
|
||||
a.Passwords[user.Name],
|
||||
a.MailboxPasswords[user.Name],
|
||||
a.TwoFAs[user.Name],
|
||||
|
||||
Reference in New Issue
Block a user