Files
nuzlocke-tracker/.beans/archive/nuzlocke-tracker-7y9z--fix-test-failures-from-admin-auth-changes.md
2026-03-22 08:56:06 +01:00

14 lines
987 B
Markdown

---
# nuzlocke-tracker-7y9z
title: Fix test failures from admin auth changes
status: completed
type: bug
priority: normal
created_at: 2026-03-21T10:33:32Z
updated_at: 2026-03-21T10:39:18Z
---
After adding require_admin to admin endpoints, tests fail:\n1. test_pokemon.py: Write endpoints return 401 because tests use unauthenticated client instead of admin client\n2. test_runs.py: mock_auth_user has id='test-user-123' which is not a valid UUID, causing ValueError in UUID(user.id)\n\nFix: add admin_override fixture, admin_client fixture, use valid UUID for mock user, update test_pokemon.py to use admin_client for write ops.
## Summary of Changes\n\n- Added `admin_override` and `admin_client` fixtures to conftest.py that override both `require_admin` and `get_current_user`\n- Changed mock user ID from `test-user-123` to a valid UUID4\n- Updated test_pokemon.py, test_games.py, and test_genlocke_boss.py to use `admin_client` for admin-protected endpoints\n- All 252 tests pass