Files
ai-hell/tests/test_main.py

33 lines
1.2 KiB
Python

from fastapi.testclient import TestClient
from server.main import create_app
class TestRESTEndpoints:
def test_status_endpoint(self):
"""GET /status returns intensity and pool info."""
test_app = create_app(skip_models=True)
with TestClient(test_app) as client:
resp = client.get("/status")
assert resp.status_code == 200
data = resp.json()
assert "intensity" in data
assert "connected_clients" in data
assert "image_pool_size" in data
def test_reset_endpoint(self):
"""POST /reset restarts escalation."""
test_app = create_app(skip_models=True)
with TestClient(test_app) as client:
resp = client.post("/reset")
assert resp.status_code == 200
assert resp.json()["status"] == "ok"
def test_index_serves_html(self):
"""GET / serves the frontend HTML (or fallback)."""
test_app = create_app(skip_models=True)
with TestClient(test_app) as client:
resp = client.get("/")
assert resp.status_code == 200
assert "text/html" in resp.headers["content-type"]