mirror of
https://github.com/mgeeky/decode-spam-headers.git
synced 2026-02-22 13:33:30 +01:00
27 lines
718 B
Python
27 lines
718 B
Python
from __future__ import annotations
|
|
|
|
import pytest
|
|
from httpx import ASGITransport, AsyncClient
|
|
|
|
from app.engine.scanner_registry import ScannerRegistry
|
|
from app.main import app
|
|
|
|
|
|
@pytest.mark.anyio
|
|
async def test_health_endpoint_returns_status() -> None:
|
|
registry = ScannerRegistry()
|
|
|
|
async with AsyncClient(
|
|
transport=ASGITransport(app=app),
|
|
base_url="http://test",
|
|
) as client:
|
|
response = await client.get("/api/health")
|
|
|
|
assert response.status_code == 200
|
|
payload = response.json()
|
|
|
|
assert payload["status"] in {"up", "degraded", "down"}
|
|
assert payload["version"]
|
|
assert payload["uptime"] >= 0
|
|
assert payload["scannerCount"] == len(registry.list_tests())
|