fix backend audit findings (auth, upload, sync, data, ocr, contract)
CI / lint-backend (push) Failing after 1m39s
CI / lint-mobile (push) Canceled after 11m8s
CI / test-backend (push) Canceled after 0s
CI / test-mobile (push) Canceled after 0s
CI / build-backend (push) Canceled after 0s
CI / docker (push) Canceled after 0s
CI / lint-backend (push) Failing after 1m39s
CI / lint-mobile (push) Canceled after 11m8s
CI / test-backend (push) Canceled after 0s
CI / test-mobile (push) Canceled after 0s
CI / build-backend (push) Canceled after 0s
CI / docker (push) Canceled after 0s
This commit is contained in:
@@ -64,6 +64,11 @@ func TestUsersUpdatePassword(t *testing.T) {
|
||||
if err != nil || row.PasswordHash != "hash-2" {
|
||||
t.Errorf("hash après update = %q (err=%v)", row.PasswordHash, err)
|
||||
}
|
||||
|
||||
// Compte inconnu → ErrNotFound (#9+A10).
|
||||
if err := u.UpdatePassword(NewID(), "hash-x"); !errors.Is(err, ErrNotFound) {
|
||||
t.Errorf("update password inconnu : attendu ErrNotFound, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUsersMarkDeletedHidesAccount(t *testing.T) {
|
||||
@@ -82,7 +87,22 @@ func TestUsersMarkDeletedHidesAccount(t *testing.T) {
|
||||
if _, err := u.GetByUsernameNormalized("carol"); !errors.Is(err, ErrNotFound) {
|
||||
t.Errorf("get par username après suppression : attendu ErrNotFound, got %v", err)
|
||||
}
|
||||
if n, _ := u.Count(); n != 1 {
|
||||
t.Errorf("count doit compter aussi les supprimés (bootstrap), got %d", n)
|
||||
// Count ne compte que les ACTIFS : carol soft-deleted → 0 (#9+A10). Une
|
||||
// base 100% soft-deleted est vue comme vide par le bootstrap.
|
||||
if n, _ := u.Count(); n != 0 {
|
||||
t.Errorf("count doit exclure les supprimés, got %d", n)
|
||||
}
|
||||
|
||||
// UpdatePassword sur compte supprimé → ErrNotFound.
|
||||
if err := u.UpdatePassword(id, "hash-2"); !errors.Is(err, ErrNotFound) {
|
||||
t.Errorf("update password après suppression : attendu ErrNotFound, got %v", err)
|
||||
}
|
||||
// Second MarkDeleted → ErrNotFound (plus de cible active).
|
||||
if err := u.MarkDeleted(id); !errors.Is(err, ErrNotFound) {
|
||||
t.Errorf("second mark deleted : attendu ErrNotFound, got %v", err)
|
||||
}
|
||||
// MarkDeleted sur inconnu → ErrNotFound.
|
||||
if err := u.MarkDeleted(NewID()); !errors.Is(err, ErrNotFound) {
|
||||
t.Errorf("mark deleted inconnu : attendu ErrNotFound, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user