feat: add FastAPI app with WebSocket streaming and escalation loop

This commit is contained in:
Mortdecai
2026-04-10 01:27:52 -04:00
parent 5d03c46dcc
commit ca52b94ffd
2 changed files with 286 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
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"]