Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: print json error #75

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading