Skip to content

Commit

Permalink
print json error (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos authored Feb 7, 2024
1 parent 65bdd43 commit 075a986
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion codeforlife/tests/model_view_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,17 @@ def generic(
status_code = response.status_code
assert status_code_assertion(
status_code
), f"Unexpected status code: {status_code}."
), f"Unexpected status code: {status_code}." + (
"\nResponse JSON: "
+ json.dumps(
# pylint: disable-next=no-member
response.json(), # type: ignore[attr-defined]
indent=2,
default=str,
)
if status_code == status.HTTP_400_BAD_REQUEST
else ""
)

return response

Expand Down

0 comments on commit 075a986

Please sign in to comment.