8000 fix validator and model check during invocation by bentsku · Pull Request #7846 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content

fix validator and model check during invocation #7846

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

Merged
merged 8 commits into from
Mar 17, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix unit test to use Empty schema if no request model
  • Loading branch information
bentsku committed Mar 16, 2023
commit 547d174535856134ceae19aefca8eda331aaf729
10 changes: 9 additions & 1 deletion tests/unit/test_apigateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,14 @@ def test_if_request_has_body_validator(self):
def test_request_validate_body_with_no_request_model(self):
apigateway_client = self._mock_client()
apigateway_client.get_request_validator.return_value = {"validateRequestBody": True}
empty_schema = json.dumps(
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Empty Schema",
"type": "object",
}
)
apigateway_client.get_model.return_value = {"schema": empty_schema}
ctx = ApiInvocationContext("POST", "/", '{"id":"1"}', {})
ctx.api_id = "deadbeef"
ctx.resource = {
Expand All @@ -177,7 +185,7 @@ def test_request_validate_body_with_no_request_model(self):
}
}
validator = RequestValidator(ctx, apigateway_client)
self.assertFalse(validator.is_request_valid())
self.assertTrue(validator.is_request_valid())

def test_request_validate_body_with_no_model_for_schema_name(self):
apigateway_client = self._mock_client()
Expand Down
0