Skip to content

Commit 07c9531

Browse files
committed
test: parse JSON instead of asserting exact whitespace in response body test
Older httpx versions (lowest-direct CI matrix) serialize JSON with a space after the colon; newer versions use compact separators. Parse the captured body instead of asserting the exact string.
1 parent c85501a commit 07c9531

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/client/auth/test_bearer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from __future__ import annotations
44

5+
import json
6+
57
import httpx
68
import pytest
79

@@ -260,7 +262,7 @@ def handler(request: httpx.Request) -> httpx.Response:
260262
async with client.stream("POST", "https://api.example.com/mcp"):
261263
pass # pragma: no cover — auth flow raises before stream body opens
262264

263-
assert captured == ['{"error":"invalid_token"}']
265+
assert [json.loads(body) for body in captured] == [{"error": "invalid_token"}]
264266

265267

266268
async def test_handler_receives_www_authenticate_header():

0 commit comments

Comments
 (0)