DFiP_Budget_planing/api/tests/integration/test_users_api_smoke.py
Raykov-MS 3d134fb7f9 srez
2026-05-08 13:16:31 +03:00

16 lines
583 B
Python

def _auth_headers(tokens: dict) -> dict:
return {"Authorization": f"Bearer {tokens['access_token']}"}
def test_users_me(client, admin_tokens):
response = client.get("/api/v1/users/me", headers=_auth_headers(admin_tokens))
assert response.status_code == 200
assert response.json()["username"] == "admin"
def test_users_list(client, admin_tokens):
listed = client.get("/api/v1/users/", headers=_auth_headers(admin_tokens))
assert listed.status_code == 200
usernames = [row["username"] for row in listed.json()["result"]]
assert "admin" in usernames