feat(15-03): update E2E seed and auth tests for OIDC architecture

- E2E seed creates API key instead of user for authentication
- Auth service tests cover only API key CRUD (removed user/session tests)
- Auth middleware tests validate three-way auth: API key, Bearer token, OIDC session
- Auth route tests mock getAuth for OIDC session, test /me and /keys endpoints
- Remove all references to createUser, verifyPassword, createSession in auth tests
This commit is contained in:
2026-04-04 20:54:18 +02:00
parent 79b27b6bcc
commit 689a56b2b7
4 changed files with 167 additions and 216 deletions

View File

@@ -202,9 +202,13 @@ export async function seedTestDatabase() {
])
.run();
// ── User ──
const passwordHash = await Bun.password.hash("password123");
db.insert(schema.users).values({ username: "admin", passwordHash }).run();
// ── API Key for E2E Authentication ──
const rawKey = "e2e-test-api-key-for-gearbox-testing";
const keyHash = await Bun.password.hash(rawKey);
const keyPrefix = rawKey.slice(0, 8);
db.insert(schema.apiKeys)
.values({ name: "E2E Test Key", keyHash, keyPrefix })
.run();
// ── Settings ──
db.insert(schema.settings)