Protect private API routes and scope agent data

This commit is contained in:
Hamza Ayed
2026-10-03 00:34:49 +03:00
parent 1c1f662850
commit b0cd825838
17 changed files with 313 additions and 95 deletions
+12
View File
@@ -0,0 +1,12 @@
"""Helpers for API tests that exercise authenticated application routes."""
from fastapi import FastAPI
from fastapi.testclient import TestClient
from app import auth, database
def authenticated_client(app: FastAPI) -> TestClient:
database.ensure_user(database.LOCAL_USER_ID)
token, _ = auth.issue_session(database.LOCAL_USER_ID)
return TestClient(app, headers={"Authorization": f"Bearer {token}"})