Add workout logging so users can track sets, reps, weight, and a
"felt easy?" toggle inline from the workout day view via HTMX.
Sessions auto-create on first log. History page shows past sessions
with detailed per-exercise breakdowns.
New services: WorkoutSessionService, LogService
New routes: POST /log, /log/{id}/edit, /log/{id}/delete, GET /history, /history/{id}
New templates: log_form, log_entry, session_card, log_history, session_detail
Modified: exercise_card (inline logging), nav (History link), workouts route (session context)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
22 lines
706 B
Python
22 lines
706 B
Python
"""Tests for log history routes."""
|
|
|
|
from fastapi.testclient import TestClient
|
|
|
|
|
|
class TestLogHistory:
|
|
"""Tests for GET /history."""
|
|
|
|
def test_history_requires_auth(self, client: TestClient) -> None:
|
|
"""GET /history should require admin login."""
|
|
response = client.get("/history", follow_redirects=False)
|
|
assert response.status_code in (401, 303)
|
|
|
|
|
|
class TestSessionDetail:
|
|
"""Tests for GET /history/<session_id>."""
|
|
|
|
def test_session_detail_requires_auth(self, client: TestClient) -> None:
|
|
"""GET /history/1 should require admin login."""
|
|
response = client.get("/history/1", follow_redirects=False)
|
|
assert response.status_code in (401, 303)
|