fix: use https base_url in test client so Secure cookies propagate automatically
httpx's cookie jar only auto-attaches Secure cookies to https:// requests. Switching the ASGITransport client fixture's base_url from http://test to https://test (no real socket is opened either way) makes it behave like a browser talking to the Cloudflare-Tunnel-terminated HTTPS edge in production, eliminating the need for manual client.cookies.set(...) re-injection workarounds in test_auth.py. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013PphXq1s43DNRj1uWKGXof
This commit is contained in:
@@ -35,5 +35,5 @@ app.dependency_overrides[get_db] = _override_get_db
|
||||
@pytest_asyncio.fixture
|
||||
async def client():
|
||||
transport = ASGITransport(app=app)
|
||||
async with AsyncClient(transport=transport, base_url="http://test") as ac:
|
||||
async with AsyncClient(transport=transport, base_url="https://test") as ac:
|
||||
yield ac
|
||||
|
||||
Reference in New Issue
Block a user