Implement Monlet MVP stack and UI updates
This commit is contained in:
26
server/tests/test_request_id.py
Normal file
26
server/tests/test_request_id.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import uuid
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_generated_request_id(app_client):
|
||||
r = await app_client.get("/api/v1/health")
|
||||
rid = r.headers.get("X-Request-Id")
|
||||
assert rid
|
||||
uuid.UUID(rid)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_incoming_request_id_preserved(app_client):
|
||||
rid_in = str(uuid.uuid4())
|
||||
r = await app_client.get("/api/v1/health", headers={"X-Request-Id": rid_in})
|
||||
assert r.headers.get("X-Request-Id") == rid_in
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_error_includes_request_id(app_client):
|
||||
rid_in = str(uuid.uuid4())
|
||||
r = await app_client.get("/api/v1/agents", headers={"X-Request-Id": rid_in})
|
||||
assert r.status_code == 401
|
||||
assert r.json()["error"]["request_id"] == rid_in
|
||||
Reference in New Issue
Block a user