forked from sr2/cloud-api
parent
c670d8ff51
commit
94cf6c5258
2 changed files with 36 additions and 0 deletions
23
test/test_auth_user.py
Normal file
23
test/test_auth_user.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
"""
|
||||
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
|
||||
"""
|
||||
import pytest
|
||||
from httpx import AsyncClient
|
||||
|
||||
from .conftest import no_user_client
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_get_self_db(no_user_client: AsyncClient):
|
||||
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
|
||||
async def test_post_org_success(no_user_client: AsyncClient):
|
||||
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"
|
||||
Loading…
Add table
Add a link
Reference in a new issue