2026-06-04 12:13:02 +01:00
|
|
|
"""
|
|
|
|
|
This testing module removes the testing user override to verify that endpoints with only the user requirement return a 401 error when not logged in
|
|
|
|
|
"""
|
2026-06-08 15:31:37 +01:00
|
|
|
|
2026-06-04 12:13:02 +01:00
|
|
|
import pytest
|
|
|
|
|
from httpx import AsyncClient
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.anyio
|
2026-06-04 14:53:35 +01:00
|
|
|
async def test_get_self_db_auth_user(no_user_client: AsyncClient):
|
2026-06-04 12:13:02 +01:00
|
|
|
resp = await no_user_client.get("/user/self/db")
|
|
|
|
|
assert resp.status_code != 422
|
|
|
|
|
assert resp.status_code == 401
|
|
|
|
|
assert resp.json()["detail"] == "Not authenticated"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.anyio
|
2026-06-04 14:53:35 +01:00
|
|
|
async def test_post_org_success_auth_user(no_user_client: AsyncClient):
|
2026-06-04 12:13:02 +01:00
|
|
|
resp = await no_user_client.post("/org", json={"name": "New Test Org"})
|
|
|
|
|
assert resp.status_code != 422
|
|
|
|
|
assert resp.status_code == 401
|
|
|
|
|
assert resp.json()["detail"] == "Not authenticated"
|