Commit 1000002
fix(test): admin shortcut to flip teacher verified for class-mode e2e
CI v6 cleared the email-required + birth-year-select issues but
exposed the next G-14 layer: golden-paths #5 (class mode) creates
a teacher then immediately POSTs /api/nauczyciel/class. New
teachers default to verified=false (G-14 spec), so the gate I
added returns 403 with `teacher-not-verified`.
Production fix is the email-link flow at /verify?token=…, but the
token isn't returned in the signup response (security: tokens go
out via the mailer, not the HTTP body). Tests need a way to
flip the flag without intercepting email.
Solution mirrors the existing admin-endpoint pattern in
`app/api/admin/seed-demo-school` and `purge-e2e-accounts`:
- `app/api/admin/teacher-verify/route.ts` (NEW). POST { username }
with `Authorization: Bearer $ADMIN_SECRET`. Calls
`markTeacherVerified` directly. Local dev without the secret is
allowed (same pattern as seed-demo-school) so dev workflow isn't
blocked.
- golden-paths #5 calls the admin endpoint with the same
E2E_ADMIN_SECRET fallback string `production-ready.spec.ts`
already uses.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 654f163 commit 1000002
2 files changed
Lines changed: 52 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
233 | 242 | | |
234 | 243 | | |
235 | 244 | | |
| |||
0 commit comments