8000 fix unit test to use Empty schema if no request model · localstack/localstack@fa2d8ec · GitHub
[go: up one dir, main page]

Skip to content

Commit fa2d8ec

Browse files
committed
fix unit test to use Empty schema if no request model
1 parent dd242d7 commit fa2d8ec

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/unit/test_apigateway.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ def test_if_request_has_body_validator(self):
166166
def test_request_validate_body_with_no_request_model(self):
167167
apigateway_client = self._mock_client()
168168
apigateway_client.get_request_validator.return_value = {"validateRequestBody": True}
169+
empty_schema = json.dumps(
170+
{
171+
"$schema": "http://json-schema.org/draft-04/schema#",
172+
"title": "Empty Schema",
173+
"type": "object",
174+
}
175+
)
176+
apigateway_client.get_model.return_value = {"schema": empty_schema}
169177
ctx = ApiInvocationContext("POST", "/", '{"id":"1"}', {})
170178
ctx.api_id = "deadbeef"
171179
ctx.resource = {
@@ -177,7 +185,7 @@ def test_request_validate_body_with_no_request_model(self):
177185
}
178186
}
179187
validator = RequestValidator(ctx, apigateway_client)
180-
self.assertFalse(validator.is_request_valid())
188+
self.assertTrue(validator.is_request_valid())
181189

182190
def test_request_validate_body_with_no_model_for_schema_name(self):
183191
apigateway_client = self._mock_client()

0 commit comments

Comments
 (0)
0