-
-
Notifications
You must be signed in to change notification settings - Fork 527
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
TestClient asserts_errors
flag behaviour is counter intuitive
#3580
Comments
Personally I find I think it should be kept because:
|
Thanks for sharing this! Didn't expect many people using the test client (we should maybe consolidate it with the one we use for our tests) I think we can rename the parameter :) @thclark would that work for you? You can always make a base class that changes the default behaviour 😊 |
No problem!
Yeah I think it slots in very well as a replacement in django development when switching from a REST API to a GraphQL API |
Feature Request Type
Description
In the
BaseGraphQLTestClient
(/test/client.py
), there is an optionasserts_errors
which is by defaultTrue
, and asserts thatresponse.errors is None
.I'm finding this to be counterintuitive for two reasons:
I think this check should be removed. If it is kept, the name should be made explicit (
assert_no_errors
) and ideally made opt-in rather than opt-out.Special concern
Is it typical for cases to arise in which errors would be returned alongside an otherwise valid response? Because if that's the case then I kind of understand why it's opt-out by default. Otherwise, testing for valid data response should be sufficient, AFAICT?
Contributing
Probably much quicker for a regular maintainer but I'm happy to make a PR for this if accepted!
Upvote & Fund
The text was updated successfully, but these errors were encountered: