from fastapi.testclient import TestClient from app.main import app client = TestClient(app) def test_history(): response = client.get("/api/v1/history") assert response.status_code == 200 data = response.json() # The endpoint returns a list of risk points, not an object with an # "incidents" key assert isinstance(data, list) if data: # if not empty, verify the structure of the first item assert "risk" in data[0] assert "time" in data[0]