Skip to content

Commit f2dcf90

Browse files
author
Brian Villemarette
committed
Add test coverage for using a list of methods
1 parent f2be849 commit f2dcf90

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/functional/event_handler/test_api_gateway.py

+24
Original file line numberDiff line numberDiff line change
@@ -879,3 +879,27 @@ def foo(app):
879879
# THEN process event correctly
880880
assert result["statusCode"] == 200
881881
assert result["headers"]["Content-Type"] == content_types.APPLICATION_JSON
882+
883+
884+
def test_api_gateway_app_proxy_with_params():
885+
# GIVEN a Blueprint with registered routes
886+
app = ApiGatewayResolver()
887+
blueprint = Blueprint()
888+
req = "foo"
889+
event = deepcopy(LOAD_GW_EVENT)
890+
event["resource"] = "/accounts/{account_id}"
891+
event["path"] = f"/accounts/{req}"
892+
893+
@blueprint.route(rule="/accounts/<account_id>", method=["GET", "POST"])
894+
def foo(app: ApiGatewayResolver, account_id):
895+
assert app.current_event.raw_event == event
896+
assert account_id == f"{req}"
897+
return {}
898+
899+
app.register_blueprint(blueprint)
900+
# WHEN calling the event handler after applying routes from blueprint object
901+
result = app(event, {})
902+
903+
# THEN process event correctly
904+
assert result["statusCode"] == 200
905+
assert result["headers"]["Content-Type"] == content_types.APPLICATION_JSON

0 commit comments

Comments
 (0)