test: adapt HTTP checks to persistent Bearer sessions

This commit is contained in:
2026-11-07 07:59:56 +03:00
parent 064421e6ee
commit 2f0a8672be
6 changed files with 155 additions and 16 deletions
+13 -3
View File
@@ -6,7 +6,7 @@ from uuid import UUID, uuid4
import httpx
import pytest
from conftest import BASE_URL, check, headers, history, register
from conftest import BASE_URL, PASSWORD, check, headers, history, register
@pytest.mark.parametrize("path", ["/health/live", "/health/ready"])
@@ -54,6 +54,8 @@ def test_identity(client, actors):
],
)
def test_invalid_user(client, data):
if isinstance(data, dict):
data = {"password": PASSWORD, **data}
check(client.post("/api/v1/users", content=json.dumps(data)), 400, "Error")
@@ -72,7 +74,11 @@ def test_duplicate_username(client, actors):
check(
client.post(
"/api/v1/users",
json={"username": actors[0]["username"], "display_name": "B"},
json={
"username": actors[0]["username"],
"display_name": "B",
"password": PASSWORD,
},
),
409,
"Error",
@@ -383,7 +389,11 @@ def test_registration_race(client):
barrier.wait(timeout=15)
result = conn.post(
"/api/v1/users",
json={"username": username, "display_name": "Test"},
json={
"username": username,
"display_name": "Test",
"password": PASSWORD,
},
)
check(
result,