Skip to content

Commit 223e36c

Browse files
author
Michael Brewer
committed
refactor: for code review
1 parent 7816ba3 commit 223e36c

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

aws_lambda_powertools/utilities/data_classes/api_gateway_authorizer_event.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ def arn(self) -> str:
3939

4040

4141
def parse_api_gateway_arn(arn: str) -> APIGatewayRouteArn:
42+
"""Parses a gateway route arn as a APIGatewayRouteArn class
43+
44+
Parameters
45+
----------
46+
arn : str
47+
ARN string for a methodArn or a routeArn
48+
Returns
49+
-------
50+
APIGatewayRouteArn
51+
"""
4252
arn_parts = arn.split(":")
4353
api_gateway_arn_parts = arn_parts[5].split("/")
4454
return APIGatewayRouteArn(
@@ -264,7 +274,7 @@ def get_header_value(
264274
return get_header_value(self.headers, name, default_value, case_sensitive)
265275

266276

267-
class APIGatewayAuthorizerSimpleResponse:
277+
class APIGatewayAuthorizerV2Response:
268278
"""Api Gateway HTTP API V2 payload authorizer simple response helper
269279
270280
Parameters

tests/functional/test_data_classes.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
)
2525
from aws_lambda_powertools.utilities.data_classes.api_gateway_authorizer_event import (
2626
APIGatewayAuthorizerRequestEvent,
27-
APIGatewayAuthorizerSimpleResponse,
2827
APIGatewayAuthorizerTokenEvent,
2928
APIGatewayAuthorizerV2Event,
29+
APIGatewayAuthorizerV2Response,
3030
parse_api_gateway_arn,
3131
)
3232
from aws_lambda_powertools.utilities.data_classes.appsync.scalar_types_utils import (
@@ -1588,9 +1588,9 @@ def test_api_gateway_authorizer_request_event():
15881588

15891589
def test_api_gateway_authorizer_simple_response():
15901590
"""Check building API Gateway authorizer simple resource"""
1591-
assert {"isAuthorized": False} == APIGatewayAuthorizerSimpleResponse().asdict()
1591+
assert {"isAuthorized": False} == APIGatewayAuthorizerV2Response().asdict()
15921592
expected_context = {"foo": "value"}
1593-
assert {"isAuthorized": True, "context": expected_context} == APIGatewayAuthorizerSimpleResponse(
1593+
assert {"isAuthorized": True, "context": expected_context} == APIGatewayAuthorizerV2Response(
15941594
authorize=True,
15951595
context=expected_context,
15961596
).asdict()

0 commit comments

Comments
 (0)