Configure initial bank history in the connection UI
This commit is contained in:
@@ -81,12 +81,15 @@ func TestReconnectReplacesOldConsentWithoutDuplicatingLocalAccount(t *testing.T)
|
||||
t.Fatal(err)
|
||||
}
|
||||
a.ops.Sessions = []banking.Session{{ID: "old_session", Accounts: []domain.Account{account}}}
|
||||
a.ops.Consents["old_session"] = Consent{Institution: "N26", Country: "DE", HistoryMonths: 24}
|
||||
cursor := time.Now().UTC().Add(-24 * time.Hour).Format(time.RFC3339)
|
||||
a.ops.AccountSync[account.ID] = cursor
|
||||
renewed := account
|
||||
renewed.ID = "provider_local_id"
|
||||
renewed.ExternalAccountID = "new_uid"
|
||||
renewed.DisplayName = "Bank-generated name"
|
||||
a.bank = &bankScenario{session: banking.Session{ID: "new_session", ValidUntil: time.Now().Add(24 * time.Hour).Format(time.RFC3339), Accounts: []domain.Account{renewed}}}
|
||||
a.authStates["one_time_state"] = authorization{Expires: time.Now().Add(time.Minute), Institution: "N26", Country: "DE"}
|
||||
a.authStates["one_time_state"] = authorization{Expires: time.Now().Add(time.Minute), Institution: "N26", Country: "DE", HistoryMonths: 24}
|
||||
if err = a.Callback(context.Background(), "bank_code", "one_time_state"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -100,6 +103,9 @@ func TestReconnectReplacesOldConsentWithoutDuplicatingLocalAccount(t *testing.T)
|
||||
if len(after.Sessions) != 1 || after.Sessions[0].ID != "new_session" {
|
||||
t.Fatal("expired session remains active after reconnect")
|
||||
}
|
||||
if a.ops.AccountSync[account.ID] != cursor || after.Connections[0].HistoryMonths != 24 {
|
||||
t.Fatal("reconnect reset the account cursor or lost the history choice")
|
||||
}
|
||||
if err = a.Callback(context.Background(), "bank_code", "one_time_state"); err == nil {
|
||||
t.Fatal("authorization state replay was accepted")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user