Repository navigation
test(bind): add behavioral tests for cwist_bind_write_error_response (#342) - #387
Open
Bhumika-1432006 wants to merge 1 commit into
Open
Bhumika-1432006 wants to merge 1 commit into
Bhumika-1432006 wants to merge 1 commit into
Conversation
…4punks#342) cwist_bind_write_error_response has no direct test (issue c4punks#342 lists it under "cwist_bind_write_error_response -- an error path with no direct test"). The existing test_bind.c exercises it only indirectly through the cwist_app_req_bind_json_or_400 convenience wrapper. This adds tests/test_bind_write_error_response.c with four cases: - single error: status_code == CWIST_HTTP_BAD_REQUEST, Content-Type is application/json, body contains "success":false and the field/message from the error struct. - multiple errors: both field names appear in the body. - zero errors: status is still 400, body has empty errors array. - null res: safe no-op (no crash). The test is wired into make test via a new Makefile target.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cwist_bind_write_error_response has no direct test; issue #342 lists it under "an error path with no direct test". The existing test_bind.c exercises it only indirectly through the cwist_app_req_bind_json_or_400 convenience wrapper.
What this adds: tests/test_bind_write_error_response.c with four cases:
How it was verified: the four assertions follow directly from the documented JSON shape in the bind.h header comment for cwist_bind_write_error_response. The test is wired into make test via a new Makefile target.
What it does not do: does not add tests for other uncovered functions in issue #342.