auth fixes

This commit is contained in:
2026-05-16 14:38:10 +00:00
parent 84038c25ec
commit a48d80d160
12 changed files with 224 additions and 56 deletions
+21
View File
@@ -64,3 +64,24 @@ async def test_inactive_user_raises_403(
await session.commit()
assert response.status_code == 403
@pytest.mark.asyncio
async def test_dev_bypass_email_uniqueness(
auth_client: AsyncClient, db_session: async_sessionmaker[Any]
) -> None:
async with db_session() as session:
result = await session.execute(select(User).where(User.email == "dev@localhost"))
existing = result.scalar_one_or_none()
if existing:
await session.delete(existing)
await session.commit()
response = await auth_client.get("/api/v1/users/me")
assert response.status_code == 200
async with db_session() as session:
result = await session.execute(select(User).where(User.email == "dev@localhost"))
user = result.scalar_one_or_none()
assert user is not None
assert user.authentik_sub == "dev-user"