diff --git a/backend/tests/test_dashboard_kpis.py b/backend/tests/test_dashboard_kpis.py index c9ea3dc..313b45b 100644 --- a/backend/tests/test_dashboard_kpis.py +++ b/backend/tests/test_dashboard_kpis.py @@ -2,6 +2,7 @@ from __future__ import annotations import os +from unittest.mock import patch import pytest from fastapi import Query @@ -11,6 +12,7 @@ os.environ.setdefault("SKIP_DB_MIGRATE", "1") from fastapi_param_unwrap import unwrap_query_default from main import app +from tenant_context import TenantContext, get_tenant_context @pytest.fixture @@ -27,3 +29,41 @@ def test_unwrap_query_default_for_direct_route_calls() -> None: def test_dashboard_kpis_unauthenticated_401(client: TestClient) -> None: r = client.get("/api/dashboard/kpis") assert r.status_code == 401 + + +def _fake_tenant_for_kpis() -> TenantContext: + return TenantContext( + profile_id=42, + global_role="trainer", + effective_club_id=7, + club_ids=frozenset({7}), + memberships=[], + ) + + +@patch("routers.dashboard.list_training_units") +@patch("routers.dashboard.list_exercises_like_get") +def test_dashboard_kpis_200_when_inner_lists_mocked( + mock_list_ex: object, + mock_list_tu: object, + client: TestClient, +) -> None: + mock_list_ex.return_value = [] + mock_list_tu.return_value = [] + app.dependency_overrides[get_tenant_context] = _fake_tenant_for_kpis + try: + r = client.get("/api/dashboard/kpis") + assert r.status_code == 200, r.text + data = r.json() + assert "year" in data + assert data["draft_count"] == 0 + assert data["mine_count"] == 0 + assert data["ytd_completed_count"] == 0 + th = data["training_home"] + assert th["upcoming"] == [] + assert th["planned_with_notes"] == [] + assert th["review_pending"] == [] + assert mock_list_ex.call_count == 2 + assert mock_list_tu.call_count == 3 + finally: + app.dependency_overrides.clear() diff --git a/backend/version.py b/backend/version.py index 35133a5..6fdba72 100644 --- a/backend/version.py +++ b/backend/version.py @@ -1,6 +1,6 @@ # Shinkan Jinkendo Version Information -APP_VERSION = "0.8.124" +APP_VERSION = "0.8.125" BUILD_DATE = "2026-05-12" DB_SCHEMA_VERSION = "20260514062" @@ -36,6 +36,14 @@ MODULE_VERSIONS = { } CHANGELOG = [ + { + "version": "0.8.125", + "date": "2026-05-13", + "changes": [ + "Tests: Playwright 11 (Übungsliste Bulk-Toolbar), 12 (Trainingsplanung); Dashboard-Test 8 prüft HTTP 200 auf /api/dashboard/kpis; pytest test_dashboard_kpis_200_when_inner_lists_mocked.", + "Frontend Phase 3: trainingPlanningPageHelpers.js aus TrainingPlanningPage; ExerciseListBulkToolbar data-testid.", + ], + }, { "version": "0.8.124", "date": "2026-05-13", diff --git a/frontend/src/components/exercises/ExerciseListBulkToolbar.jsx b/frontend/src/components/exercises/ExerciseListBulkToolbar.jsx index 1e1ea18..084dcd3 100644 --- a/frontend/src/components/exercises/ExerciseListBulkToolbar.jsx +++ b/frontend/src/components/exercises/ExerciseListBulkToolbar.jsx @@ -9,7 +9,7 @@ export default function ExerciseListBulkToolbar({ if (selectedCount < 1) return null return ( -
+
{selectedCount} ausgewählt