Skip to content

Commit af20378

Browse files
snopokeclaude
andcommitted
fix test compatibility with httpx 0.28
Use match_json instead of match_content in pytest-httpx mocks since httpx 0.28 changed JSON serialization to compact format. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 03ffd64 commit af20378

3 files changed

Lines changed: 331 additions & 126 deletions

File tree

tests/test_scope.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ def test_create_task_with_scope(httpx_mock):
5858
url="https://taskbadger.net/api/org/project/tasks/",
5959
method="POST",
6060
match_headers={"Authorization": "Bearer token"},
61-
match_content=b'{"name": "name", "status": "pending", '
62-
b'"data": {"foo": "bar", "bar": "buzzer"}, '
63-
b'"tags": {"name": "value", "name1": "value1"}}',
61+
match_json={
62+
"name": "name",
63+
"status": "pending",
64+
"data": {"foo": "bar", "bar": "buzzer"},
65+
"tags": {"name": "value", "name1": "value1"},
66+
},
6467
json=_json_task_response(),
6568
status_code=201,
6669
)

tests/test_sdk_primatives.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import json
2-
31
import pytest
42

53
from taskbadger import Action, EmailIntegration, StatusEnum, update_task
@@ -30,7 +28,7 @@ def test_create_task(httpx_mock):
3028
url="https://taskbadger.net/api/org/project/tasks/",
3129
method="POST",
3230
match_headers={"Authorization": "Bearer token"},
33-
match_content=b'{"name": "name", "status": "pending"}',
31+
match_json={"name": "name", "status": "pending"},
3432
json=_json_task_response(),
3533
status_code=201,
3634
)
@@ -81,7 +79,7 @@ def test_update_task(httpx_mock):
8179
url="https://taskbadger.net/api/org/project/tasks/test_id/",
8280
method="PATCH",
8381
match_headers={"Authorization": "Bearer token"},
84-
match_content=json.dumps(expected_body).encode("utf8"),
82+
match_json=expected_body,
8583
json=_json_task_response(),
8684
status_code=200,
8785
)
@@ -103,7 +101,7 @@ def test_update_task_actions(httpx_mock):
103101
url="https://taskbadger.net/api/org/project/tasks/test_id/",
104102
method="PATCH",
105103
match_headers={"Authorization": "Bearer token"},
106-
match_content=json.dumps(expected_body).encode("utf8"),
104+
match_json=expected_body,
107105
json=_json_task_response(),
108106
status_code=200,
109107
)

0 commit comments

Comments
 (0)