Fix FastAPI index rendering
Use the current TemplateResponse signature and cover the live controls page.
This commit is contained in:
+1
-1
@@ -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")
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user