35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
"""Isolated production gateway for the sidebar/title browser regression."""
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
|
# Reuse the test suite's complete persistence isolation before importing the app.
|
|
import pytest
|
|
|
|
from tests.auth_provider import install_test_auth
|
|
from tests.conftest import _SESSION_ROOT
|
|
|
|
os.environ["APS_AUTH_COOKIE_SECURE"] = "0"
|
|
os.environ["APS_SEED_DEMO"] = "0"
|
|
os.environ["APS_AUTOMATION_DRIVER"] = "0"
|
|
patch = pytest.MonkeyPatch()
|
|
install_test_auth(patch, "tenant-session-title-e2e")
|
|
from server.gateway.app import create_app
|
|
|
|
app = create_app()
|
|
|
|
|
|
@app.middleware("http")
|
|
async def mark_isolation(request, call_next):
|
|
response = await call_next(request)
|
|
if request.url.path == "/api/health":
|
|
assert Path(os.environ["APS_DB_PATH"]).is_relative_to(_SESSION_ROOT)
|
|
response.headers["X-Session-Title-E2E"] = "isolated"
|
|
return response
|
|
|
|
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
uvicorn.run(app, host="127.0.0.1", port=int(os.environ.get("TITLE_E2E_PORT", "18789")))
|