Skip to content

Commit 9e1c810

Browse files
committed
Add tests
1 parent 7ae433d commit 9e1c810

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

aws_lambda_powertools/utilities/data_classes/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
from .cloud_watch_custom_widget_event import CloudWatchDashboardCustomWidgetEvent
1919
from .cloud_watch_logs_event import CloudWatchLogsEvent
2020
from .cloudformation_custom_resource_event import CloudFormationCustomResourceEvent
21+
from .code_deploy_lifecycle_hook_event import (
22+
CodeDeployLifeCycleHookLambdaEvent,
23+
)
2124
from .code_pipeline_job_event import CodePipelineJobEvent
2225
from .connect_contact_flow_event import ConnectContactFlowEvent
2326
from .dynamo_db_stream_event import DynamoDBStreamEvent
@@ -59,6 +62,7 @@
5962
"CloudWatchAlarmMetricStat",
6063
"CloudWatchDashboardCustomWidgetEvent",
6164
"CloudWatchLogsEvent",
65+
"CodeDeployLifeCycleHookLambdaEvent",
6266
"CodePipelineJobEvent",
6367
"ConnectContactFlowEvent",
6468
"DynamoDBStreamEvent",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"DeploymentId": "d-ABCDEF",
3+
"LifecycleEventHookExecutionId": "xxxxxxxxxxxxxxxxxxxxxxxx"
4+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import pytest
2+
3+
from aws_lambda_powertools.utilities.data_classes import (
4+
CodeDeployLifeCycleHookLambdaEvent,
5+
)
6+
from tests.functional.utils import load_event
7+
8+
9+
@pytest.mark.parametrize(
10+
"event_file",
11+
[
12+
"codeDeployLifecycleHookEvent.json",
13+
],
14+
)
15+
def test_code_deploy_lifecycle_hook_event(event_file):
16+
raw_event = load_event(event_file)
17+
parsed_event = CodeDeployLifeCycleHookLambdaEvent(raw_event)
18+
19+
assert parsed_event.deployment_id == raw_event["DeploymentId"]
20+
assert parsed_event.lifecycle_event_hook_execution_id == raw_event["LifecycleEventHookExecutionId"]

0 commit comments

Comments
 (0)