test: unify auth headers into a single conftest fixture

Replace 9 duplicated per-file 'headers' fixtures and the awkward
'auth_headers' coroutine factory with one canonical 'headers' fixture
in conftest.py. Migrate liveview/media tests off the await-based
factory. No behavior change; 627 passed.

ha-relevant: no
This commit is contained in:
Pouzor
2026-07-09 21:26:45 +02:00
parent 9051f6ca3e
commit 3384a05932
12 changed files with 17 additions and 98 deletions
-7
View File
@@ -20,13 +20,6 @@ from app.core.config import settings
from app.db.models import Design, Edge, Node, PendingDevice, PendingDeviceLink
@pytest.fixture
async def headers(client: AsyncClient):
res = await client.post("/api/v1/auth/login", json={"username": "admin", "password": "admin"})
token = res.json()["access_token"]
return {"Authorization": f"Bearer {token}"}
@pytest.fixture(autouse=True)
def _clear_env_token():
"""Ensure a clean token state per test; restore afterwards."""