Remove all authentication (login, sessions, bcrypt, itsdangerous) since the app runs on a private homelab LAN. Replace with a profile picker landing page and cookie-based profile selection (1-year expiry). - Add Alembic migration to drop password_hash/is_admin columns - Delete auth service, auth routes, login template, and auth tests - Rewrite app/utils/auth.py with NoProfileSelectedError and require_active_profile dependency - Add profile creation flow (GET/POST /profiles/create) - Rewrite home page as profile picker with card layout - Update all route files to use profile dependency instead of admin auth - Remove bcrypt and itsdangerous from requirements - Remove admin_username/admin_password from config - Update all tests for new profile-based access model Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
"""Tests for workout day viewer routes."""
|
|
|
|
from fastapi.testclient import TestClient
|
|
|
|
from tests.conftest import set_profile_cookie
|
|
|
|
|
|
class TestWorkoutDayViewer:
|
|
"""Tests for GET /workouts/<day_name>."""
|
|
|
|
def test_workout_day_requires_profile(self, client: TestClient) -> None:
|
|
"""GET /workouts/push should redirect to / without profile cookie."""
|
|
response = client.get("/workouts/push", follow_redirects=False)
|
|
assert response.status_code == 302
|
|
assert response.headers["location"] == "/"
|
|
|
|
def test_workout_days_list_requires_profile(self, client: TestClient) -> None:
|
|
"""GET /workouts should redirect to / without profile cookie."""
|
|
response = client.get("/workouts", follow_redirects=False)
|
|
assert response.status_code == 302
|
|
assert response.headers["location"] == "/"
|
|
|
|
def test_workout_days_list_with_profile(self, client: TestClient) -> None:
|
|
"""GET /workouts should succeed with a valid profile cookie."""
|
|
set_profile_cookie(client, 1)
|
|
response = client.get("/workouts")
|
|
assert response.status_code == 200
|