Skip to content

Commit ed9fbda

Browse files
committed
Ensure response content is preserved in HTTPError
Closes #89
1 parent bb6597c commit ed9fbda

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/test_http_requests.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import responses
88
from requests import HTTPError, Session
99

10-
from tests.conftest import DEFAULT_TOKEN
10+
from tests.data.test_defaults import DEFAULT_TOKEN
1111
from todoist_api_python.endpoints import BASE_URL, TASKS_ENDPOINT
1212
from todoist_api_python.http_requests import delete, get, post
1313

@@ -42,12 +42,15 @@ def test_get_raise_for_status() -> None:
4242
responses.add(
4343
responses.GET,
4444
DEFAULT_URL,
45+
json="<error description>",
4546
status=500,
4647
)
4748

48-
with pytest.raises(HTTPError):
49+
with pytest.raises(HTTPError) as error_info:
4950
get(Session(), DEFAULT_URL, DEFAULT_TOKEN)
5051

52+
assert error_info.value.response.content == b'"<error description>"'
53+
5154

5255
@responses.activate
5356
def test_post_with_data(default_task_response: dict[str, Any]) -> None:

0 commit comments

Comments
 (0)