All checks were successful
Deploy Development / deploy (push) Successful in 41s
Test Suite / pytest-backend (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m2s
Test Suite / pytest-backend (pull_request) Successful in 34s
Test Suite / lint-backend (pull_request) Successful in 0s
Test Suite / build-frontend (pull_request) Successful in 12s
Test Suite / k6 /health Baseline (pull_request) Successful in 33s
Test Suite / playwright-tests (pull_request) Successful in 1m1s
- Bumped APP_VERSION to 0.8.123 and updated the changelog to reflect recent changes. - Fixed internal calls in GET /api/dashboard/kpis to use unwrap_query_default, preventing 500 errors due to FastAPI query defaults. - Enhanced list_exercises and list_training_units functions to utilize unwrap_query_default for improved query handling. - Added unit tests for unwrap_query_default to ensure correct behavior in various scenarios.
30 lines
764 B
Python
30 lines
764 B
Python
"""GET /api/dashboard/kpis: Auth + interne Aufruf-Hilfen."""
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
import pytest
|
|
from fastapi import Query
|
|
from fastapi.testclient import TestClient
|
|
|
|
os.environ.setdefault("SKIP_DB_MIGRATE", "1")
|
|
|
|
from fastapi_param_unwrap import unwrap_query_default
|
|
from main import app
|
|
|
|
|
|
@pytest.fixture
|
|
def client() -> TestClient:
|
|
return TestClient(app)
|
|
|
|
|
|
def test_unwrap_query_default_for_direct_route_calls() -> None:
|
|
assert unwrap_query_default(Query(default=None)) is None
|
|
assert unwrap_query_default("2026-01-01") == "2026-01-01"
|
|
assert unwrap_query_default(7) == 7
|
|
|
|
|
|
def test_dashboard_kpis_unauthenticated_401(client: TestClient) -> None:
|
|
r = client.get("/api/dashboard/kpis")
|
|
assert r.status_code == 401
|