mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-06 20:15:17 +02:00
fix(e2e): call .unique() when minting test token
The User mapper eager-loads the oauth_accounts collection via joined load under AUTH_TYPE=GOOGLE, so the mint endpoint's query must call .unique() before scalar_one_or_none() to avoid InvalidRequestError (500).
This commit is contained in:
parent
a3d05f6418
commit
bfadde93b7
1 changed files with 3 additions and 1 deletions
|
|
@ -51,7 +51,9 @@ async def mint_test_token(
|
|||
raise HTTPException(status_code=403, detail="invalid e2e mint secret")
|
||||
async with async_session_maker() as session:
|
||||
result = await session.execute(select(User).where(User.email == body.email))
|
||||
user = result.scalar_one_or_none()
|
||||
# ``.unique()`` is required because the User mapper eager-loads a
|
||||
# collection (oauth_accounts) via joined load.
|
||||
user = result.unique().scalar_one_or_none()
|
||||
if user is None:
|
||||
raise HTTPException(
|
||||
status_code=404, detail=f"e2e user {body.email!r} not seeded"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue