Skip to content

[5.4] Add assertJsonStructureMissing to TestResponse #20435

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

Closed
wants to merge 2 commits into from
Closed

[5.4] Add assertJsonStructureMissing to TestResponse #20435

wants to merge 2 commits into from

Conversation

behzadsh
Copy link

@behzadsh behzadsh commented Aug 5, 2017

Sometime when you testing an API response, you need to check that a key is not present in JSON response. I added assertJsonStructureMissing to TestResponse class that do this check.

@behzadsh behzadsh changed the title Add assertJsonMissingStructure to TestResponse [5.4] Add assertJsonMissingStructure to TestResponse Aug 5, 2017
@behzadsh behzadsh changed the title [5.4] Add assertJsonMissingStructure to TestResponse [5.4] Add assertJsonStructureMissing to TestResponse Aug 5, 2017
@taylorotwell
Copy link
Member

You can macro this in or release a package if you like.

@OrkhanAlikhanov
Copy link

I wonder what would be the reason for not accepting this addition. I find myself a lot during tests asserting that json structure misses some keys based on user's privileges, for example json should miss answer field if user is not teacher.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants