auth fixes
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user