-
Notifications
You must be signed in to change notification settings - Fork 141
Add except option for testing error responses#465
Open
sadahiro-ono wants to merge 2 commits intointeragent:master from
Open
Add except option for testing error responses #465sadahiro-ono wants to merge 2 commits intointeragent:master from
sadahiro-ono wants to merge 2 commits intointeragent:master from
Conversation
Add `except` option to `assert_request_schema_confirm` to allow intentionally omitting required parameters when testing error responses (401, 400, etc.) while still validating other parameters. Features: - Exclude specific parameters from validation by type (headers, query, path, body) - Support multiple parameters in each type simultaneously - Validate that non-excepted parameters still raise errors when missing Implementation: - Add ExceptParameter class with handler pattern for each param type - Refactor QueryHandler, PathHandler, BodyHandler using BaseHashParameterHandler to eliminate code duplication (DRY principle) - Use rack.request.query_hash for query parameters with ||= initialization - Properly restore original values after validation using ensure block Tests: - Add comprehensive test cases for all parameter types - Add /test_except_validation endpoint for testing except behavior - Verify non-excepted parameters still raise validation errors Documentation: - Add usage examples with generic parameter names to README.md - Document except option for error response testing scenarios
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.
Uh oh!
There was an error while loading. Please reload this page.
Add
exceptoption toassert_request_schema_confirmto allowintentionally omitting required parameters when testing error responses
(401, 400, etc.) while still validating other parameters.
Features
Implementation
to eliminate code duplication (DRY principle)
query:page,path:id) in original_values hash to:Tests
Documentation