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

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

8000
Appearance settings

Commit ce44518

Browse files
committed
fix unit test to use Empty schema if no request model
1 parent 34e09c6 commit ce44518

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