35 lines
962 B
Python
35 lines
962 B
Python
from __future__ import annotations
|
|
|
|
from fastapi.testclient import TestClient
|
|
|
|
from app.api.routes import health
|
|
from app.main import app
|
|
|
|
|
|
def test_health_endpoint_returns_status_payload() -> None:
|
|
client = TestClient(app)
|
|
response = client.get("/health")
|
|
|
|
assert response.status_code == 200
|
|
|
|
payload = response.json()
|
|
assert payload["status"] in {"ok", "degraded"}
|
|
assert payload["service"] == "geointel-backend"
|
|
assert payload["version"] == "0.1.0"
|
|
|
|
|
|
def test_system_capabilities_reports_gis_dependency_flags(monkeypatch) -> None:
|
|
monkeypatch.setattr(
|
|
health,
|
|
"_dependency_enabled",
|
|
lambda module_name: module_name in {"rasterio", "geopandas"},
|
|
)
|
|
|
|
client = TestClient(app)
|
|
response = client.get("/api/v1/system/capabilities")
|
|
|
|
assert response.status_code == 200
|
|
payload = response.json()
|
|
assert payload["data"]["rasterio"] is True
|
|
assert payload["data"]["geopandas"] is True
|