29 lines
793 B
Python
29 lines
793 B
Python
from fastapi.testclient import TestClient
|
|
|
|
from main import app
|
|
|
|
client = TestClient(app)
|
|
|
|
def test_dashboard_endpoint():
|
|
"""Test that the dashboard endpoint returns structured data."""
|
|
response = client.get("/analyze/dashboard")
|
|
assert response.status_code == 200
|
|
data = response.json()
|
|
|
|
# Check structure
|
|
assert "summary" in data
|
|
assert "breakdown" in data
|
|
assert "strength_sessions" in data
|
|
|
|
# Check summary fields
|
|
summary = data["summary"]
|
|
assert "total_hours" in summary
|
|
assert "trend_pct" in summary
|
|
assert "period_label" in summary
|
|
|
|
def test_health_endpoint():
|
|
"""Test the health check endpoint."""
|
|
response = client.get("/health")
|
|
assert response.status_code == 200
|
|
assert response.json() == {"status": "ok"}
|