From a443909d640fb3c7f8466fca66b4df7b5daa8b03 Mon Sep 17 00:00:00 2001 From: Daniel Gradman-Svendsen Date: Wed, 29 Jul 2026 14:48:48 +0200 Subject: [PATCH] Fix FastAPI index rendering Use the current TemplateResponse signature and cover the live controls page. --- importarr/main.py | 2 +- tests/test_status.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/importarr/main.py b/importarr/main.py index 289b36b..897a8d2 100644 --- a/importarr/main.py +++ b/importarr/main.py @@ -55,7 +55,7 @@ def health() -> dict[str, str]: @app.get("/", response_class=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") diff --git a/tests/test_status.py b/tests/test_status.py index 19a45fc..d043441 100644 --- a/tests/test_status.py +++ b/tests/test_status.py @@ -18,3 +18,16 @@ def test_status_contains_service_configuration(tmp_path, monkeypatch): assert "movies_root" in payload assert "tv_root" 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