refac: stale test entries, failing web tests, Postgre backup bug, Hardcoded MySQL table count, Stale Postgre connection in test, own-scope visibility filter, GetAll ignoring its error, JSON tags in use-case types, 31 copies of DESKTOP_QUERY, ProfileView endpoint paths

This commit is contained in:
Florian Sylvain committed 2026-10-28 17:54:10 +01:00
1 parent efecdee200
commit 5d6f378fce
87 files changed
+696 -373

No files matched your search

+4 -3
View File
@@ -185,7 +185,7 @@ func TestPostgresMigration(t *testing.T) {
})
t.Run("a legacy users.role column is backfilled into role_id and the invites get Admin", func(t *testing.T) {
_, _, db := migratedPostgres(t)
server, config, db := migratedPostgres(t)
addLegacyRoleColumn(t, db)
for _, name := range []string{"first", "second", "third"} {
insert := db.Exec("INSERT INTO users (username, password, email, role, is_verified, token_version) VALUES (?, 'x', ?, '', true, 0)", name, name+"@x.example")
@@ -193,6 +193,7 @@ func TestPostgresMigration(t *testing.T) {
t.Fatalf("insert %s: %v", name, insert.Error)
}
}
db = server.connect(t, config).DB
if err := database.Migrate(db, migrationPublicURL); err != nil {
t.Fatalf("migrate: %v", err)
@@ -241,7 +242,7 @@ func TestPostgresTimesInLists(t *testing.T) {
mustCreateUser(t, repos, user)
}
users := repos.users.GetAll()
users := allOf(repos.users.GetAll())
if len(users) != 2 {
t.Fatalf("expected 2 users, got %d", len(users))
@@ -402,7 +403,7 @@ func TestPostgresBackup(t *testing.T) {
t.Errorf("replaying the dump must restore the same schema and rows, first difference: %s", line)
}
restoredRepos := newContractRepositories(restored.DB)
restoredUsers := restoredRepos.users.GetAll()
restoredUsers := allOf(restoredRepos.users.GetAll())
if len(restoredUsers) != 2 || restoredUsers[0].Username != "o'brien \"quoted\" back\\slash\nline é😀" || restoredUsers[1].PasswordResetCode != "reset-code" {
t.Errorf("unexpected restored users %+v", restoredUsers)
}