Fix FastAPI index rendering

Use the current TemplateResponse signature and cover the live controls page.
This commit is contained in:
2026-07-29 14:48:48 +02:00
parent f4d151f9fe
commit a443909d64
2 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ def health() -> dict[str, str]:
@app.get("/", response_class=HTMLResponse) @app.get("/", response_class=HTMLResponse)
def index(request: Request) -> HTMLResponse: def index(request: Request) -> HTMLResponse:
return templates.TemplateResponse("index.html", {"request": request, "status": status(), "batches": state.list_manual_batches()}) return templates.TemplateResponse(request, "index.html", {"status": status(), "batches": state.list_manual_batches()})
@app.get("/api/status") @app.get("/api/status")
+13
View File
@@ -18,3 +18,16 @@ def test_status_contains_service_configuration(tmp_path, monkeypatch):
assert "movies_root" in payload assert "movies_root" in payload
assert "tv_root" in payload assert "tv_root" in payload
assert "auth_enabled" in payload assert "auth_enabled" in payload
def test_index_renders_queue_controls(tmp_path, monkeypatch):
monkeypatch.setenv("IMPORTARR_STATE_PATH", str(tmp_path / "state.db"))
import importarr.main as main
from fastapi.testclient import TestClient
response = TestClient(main.app).get("/")
assert response.status_code == 200
assert "Queue controls" in response.text
assert "cancel-current" in response.text