replace static status definition by const
This commit is contained in:
+9
-9
@@ -32,11 +32,11 @@ func TestCreateUser(t *testing.T) {
|
||||
if created.Principal.Name != "Alice" {
|
||||
t.Fatalf("name = %q, attendu Alice", created.Principal.Name)
|
||||
}
|
||||
if created.Principal.Status != "active" {
|
||||
t.Fatalf("status = %q, attendu active", created.Principal.Status)
|
||||
if created.Principal.Status != identity.StatusActive {
|
||||
t.Fatalf("status = %q, attendu %q", created.Principal.Status, identity.StatusActive)
|
||||
}
|
||||
if created.Account.State != "active" {
|
||||
t.Fatalf("état du compte = %q, attendu active", created.Account.State)
|
||||
if created.Account.State != AccountStateActive {
|
||||
t.Fatalf("état du compte = %q, attendu %q", created.Account.State, AccountStateActive)
|
||||
}
|
||||
if len(created.Principal.Groups) != 1 || created.Principal.Groups[0].Name != "members" {
|
||||
t.Fatalf("groupes = %+v, attendu members", created.Principal.Groups)
|
||||
@@ -198,8 +198,8 @@ func TestAuthenticateLocksAccountAfterTooManyFailures(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("GetAccount : %v", err)
|
||||
}
|
||||
if account.State != "locked" {
|
||||
t.Fatalf("state = %q, attendu locked", account.State)
|
||||
if account.State != AccountStateLocked {
|
||||
t.Fatalf("state = %q, attendu %q", account.State, AccountStateLocked)
|
||||
}
|
||||
if !account.LockedUntil.Valid || account.LockedUntil.Int64 <= time.Now().UnixMilli() {
|
||||
t.Fatalf("locked_until = %+v, attendu dans le futur", account.LockedUntil)
|
||||
@@ -232,8 +232,8 @@ func TestAuthenticateUnlocksExpiredAccount(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("GetAccount : %v", err)
|
||||
}
|
||||
if account.State != "active" {
|
||||
t.Fatalf("state = %q, attendu active", account.State)
|
||||
if account.State != AccountStateActive {
|
||||
t.Fatalf("state = %q, attendu %q", account.State, AccountStateActive)
|
||||
}
|
||||
if account.FailedAttempts != 0 {
|
||||
t.Fatalf("failed_attempts = %d, attendu 0", account.FailedAttempts)
|
||||
@@ -247,7 +247,7 @@ func TestAuthenticateRejectsDisabledAccount(t *testing.T) {
|
||||
created := mustCreateUser(t, service, "alice", "correct horse battery staple", identity.RoleMember)
|
||||
|
||||
_, err := service.db.WriteQueries.UpdateAccountState(ctx, database.UpdateAccountStateParams{
|
||||
State: "disabled",
|
||||
State: AccountStateDisabled,
|
||||
PrincipalID: created.Principal.ID,
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user