from fastapi.testclient import TestClient from app.main import app def test_internal_authentik_ensure_requires_config() -> None: client = TestClient(app) resp = client.post( "/internal/authentik/users/ensure", headers={"X-Internal-Secret": "CHANGE_ME"}, json={ "sub": "authentik-sub-1", "email": "user@example.com", "display_name": "User Example", "is_active": True, }, ) assert resp.status_code == 503 assert resp.json()["detail"] == "authentik_admin_not_configured"