Skip to content

Commit fe8b0cf

Browse files
committed
add test for other event file
1 parent 5424c78 commit fe8b0cf

File tree

9 files changed

+1053
-507
lines changed

9 files changed

+1053
-507
lines changed

tests/unit/event_handler/_async_execution/_routes/test_aws_config_rule.py

Lines changed: 116 additions & 507 deletions
Large diffs are not rendered by default.

tests/unit/event_handler/_async_execution/_routes/test_cloud_watch_alarm.py

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,3 +344,119 @@ def test_match_false(self, event_name, option_constructor):
344344
route = CloudWatchAlarmRoute(**option_constructor)
345345
actual = route.match(event=event)
346346
assert actual is None
347+
348+
@pytest.mark.parametrize(
349+
"event_name",
350+
[
351+
"activeMQEvent.json",
352+
"albEvent.json",
353+
"albEventPathTrailingSlash.json",
354+
"albMultiValueHeadersEvent.json",
355+
"albMultiValueQueryStringEvent.json",
356+
"apiGatewayAuthorizerRequestEvent.json",
357+
"apiGatewayAuthorizerTokenEvent.json",
358+
"apiGatewayAuthorizerV2Event.json",
359+
"apiGatewayProxyEvent.json",
360+
"apiGatewayProxyEventAnotherPath.json",
361+
"apiGatewayProxyEventNoOrigin.json",
362+
"apiGatewayProxyEventPathTrailingSlash.json",
363+
"apiGatewayProxyEventPrincipalId.json",
364+
"apiGatewayProxyEvent_noVersionAuth.json",
365+
"apiGatewayProxyOtherEvent.json",
366+
"apiGatewayProxyV2Event.json",
367+
"apiGatewayProxyV2EventPathTrailingSlash.json",
368+
"apiGatewayProxyV2Event_GET.json",
369+
"apiGatewayProxyV2IamEvent.json",
370+
"apiGatewayProxyV2LambdaAuthorizerEvent.json",
371+
"apiGatewayProxyV2OtherGetEvent.json",
372+
"apiGatewayProxyV2SchemaMiddlwareInvalidEvent.json",
373+
"apiGatewayProxyV2SchemaMiddlwareValidEvent.json",
374+
"apigatewayeSchemaMiddlwareInvalidEvent.json",
375+
"apigatewayeSchemaMiddlwareValidEvent.json",
376+
"appSyncAuthorizerEvent.json",
377+
"appSyncAuthorizerResponse.json",
378+
"appSyncBatchEvent.json",
379+
"appSyncDirectResolver.json",
380+
"appSyncResolverEvent.json",
381+
"awsConfigRuleConfigurationChanged.json",
382+
"awsConfigRuleOversizedConfiguration.json",
383+
"awsConfigRuleScheduled.json",
384+
"bedrockAgentEvent.json",
385+
"bedrockAgentEventWithPathParams.json",
386+
"bedrockAgentPostEvent.json",
387+
"cloudWatchDashboardEvent.json",
388+
"cloudWatchLogEvent.json",
389+
"cloudWatchLogEventWithPolicyLevel.json",
390+
"cloudformationCustomResourceCreate.json",
391+
"cloudformationCustomResourceDelete.json",
392+
"cloudformationCustomResourceUpdate.json",
393+
"codeDeployLifecycleHookEvent.json",
394+
"codePipelineEvent.json",
395+
"codePipelineEventData.json",
396+
"codePipelineEventEmptyUserParameters.json",
397+
"codePipelineEventWithEncryptionKey.json",
398+
"cognitoCreateAuthChallengeEvent.json",
399+
"cognitoCustomEmailSenderEvent.json",
400+
"cognitoCustomMessageEvent.json",
401+
"cognitoCustomSMSSenderEvent.json",
402+
"cognitoDefineAuthChallengeEvent.json",
403+
"cognitoPostAuthenticationEvent.json",
404+
"cognitoPostConfirmationEvent.json",
405+
"cognitoPreAuthenticationEvent.json",
406+
"cognitoPreSignUpEvent.json",
407+
"cognitoPreTokenGenerationEvent.json",
408+
"cognitoPreTokenV2GenerationEvent.json",
409+
"cognitoUserMigrationEvent.json",
410+
"cognitoVerifyAuthChallengeResponseEvent.json",
411+
"connectContactFlowEventAll.json",
412+
"connectContactFlowEventMin.json",
413+
"dynamoStreamEvent.json",
414+
"eventBridgeEvent.json",
415+
"kafkaEventMsk.json",
416+
"kafkaEventSelfManaged.json",
417+
"kinesisFirehoseKinesisEvent.json",
418+
"kinesisFirehosePutEvent.json",
419+
"kinesisFirehoseSQSEvent.json",
420+
"kinesisStreamCloudWatchLogsEvent.json",
421+
"kinesisStreamEvent.json",
422+
"kinesisStreamEventOneRecord.json",
423+
"lambdaFunctionUrlEvent.json",
424+
"lambdaFunctionUrlEventPathTrailingSlash.json",
425+
"lambdaFunctionUrlEventWithHeaders.json",
426+
"lambdaFunctionUrlIAMEvent.json",
427+
"rabbitMQEvent.json",
428+
"s3BatchOperationEventSchemaV1.json",
429+
"s3BatchOperationEventSchemaV2.json",
430+
"s3Event.json",
431+
"s3EventBridgeNotificationObjectCreatedEvent.json",
432+
"s3EventBridgeNotificationObjectDeletedEvent.json",
433+
"s3EventBridgeNotificationObjectExpiredEvent.json",
434+
"s3EventBridgeNotificationObjectRestoreCompletedEvent.json",
435+
"s3EventDecodedKey.json",
436+
"s3EventDeleteObject.json",
437+
"s3EventGlacier.json",
438+
"s3ObjectEventIAMUser.json",
439+
"s3ObjectEventTempCredentials.json",
440+
"s3SqsEvent.json",
441+
"secretsManagerEvent.json",
442+
"sesEvent.json",
443+
"snsEvent.json",
444+
"snsSqsEvent.json",
445+
"snsSqsFifoEvent.json",
446+
"sqsDlqTriggerEvent.json",
447+
"sqsEvent.json",
448+
"vpcLatticeEvent.json",
449+
"vpcLatticeEventPathTrailingSlash.json",
450+
"vpcLatticeEventV2PathTrailingSlash.json",
451+
"vpcLatticeV2Event.json",
452+
"vpcLatticeV2EventWithHeaders.json",
453+
],
454+
)
455+
def test_match_for_not_cloud_watch_alarm_event(self, event_name):
456+
event = load_event(file_name=event_name)
457+
route = CloudWatchAlarmRoute(
458+
func=None,
459+
arn="arn:aws:cloudwatch:us-east-1:111122223333:alarm:SuppressionDemo.Main",
460+
)
461+
actual = route.match(event=event)
462+
assert actual is None

tests/unit/event_handler/_async_execution/_routes/test_cloud_watch_logs.py

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,3 +711,116 @@ def test_match_false(self, event_name, option_constructor):
711711
route = CloudWatchLogsRoute(**option_constructor)
712712
actual = route.match(event=event)
713713
assert actual is None
714+
715+
@pytest.mark.parametrize(
716+
"event_name",
717+
[
718+
"activeMQEvent.json",
719+
"albEvent.json",
720+
"albEventPathTrailingSlash.json",
721+
"albMultiValueHeadersEvent.json",
722+
"albMultiValueQueryStringEvent.json",
723+
"apiGatewayAuthorizerRequestEvent.json",
724+
"apiGatewayAuthorizerTokenEvent.json",
725+
"apiGatewayAuthorizerV2Event.json",
726+
"apiGatewayProxyEvent.json",
727+
"apiGatewayProxyEventAnotherPath.json",
728+
"apiGatewayProxyEventNoOrigin.json",
729+
"apiGatewayProxyEventPathTrailingSlash.json",
730+
"apiGatewayProxyEventPrincipalId.json",
731+
"apiGatewayProxyEvent_noVersionAuth.json",
732+
"apiGatewayProxyOtherEvent.json",
733+
"apiGatewayProxyV2Event.json",
734+
"apiGatewayProxyV2EventPathTrailingSlash.json",
735+
"apiGatewayProxyV2Event_GET.json",
736+
"apiGatewayProxyV2IamEvent.json",
737+
"apiGatewayProxyV2LambdaAuthorizerEvent.json",
738+
"apiGatewayProxyV2OtherGetEvent.json",
739+
"apiGatewayProxyV2SchemaMiddlwareInvalidEvent.json",
740+
"apiGatewayProxyV2SchemaMiddlwareValidEvent.json",
741+
"apigatewayeSchemaMiddlwareInvalidEvent.json",
742+
"apigatewayeSchemaMiddlwareValidEvent.json",
743+
"appSyncAuthorizerEvent.json",
744+
"appSyncAuthorizerResponse.json",
745+
"appSyncBatchEvent.json",
746+
"appSyncDirectResolver.json",
747+
"appSyncResolverEvent.json",
748+
"awsConfigRuleConfigurationChanged.json",
749+
"awsConfigRuleOversizedConfiguration.json",
750+
"awsConfigRuleScheduled.json",
751+
"bedrockAgentEvent.json",
752+
"bedrockAgentEventWithPathParams.json",
753+
"bedrockAgentPostEvent.json",
754+
"cloudWatchAlarmEventCompositeMetric.json",
755+
"cloudWatchAlarmEventSingleMetric.json",
756+
"cloudWatchDashboardEvent.json",
757+
"cloudformationCustomResourceCreate.json",
758+
"cloudformationCustomResourceDelete.json",
759+
"cloudformationCustomResourceUpdate.json",
760+
"codeDeployLifecycleHookEvent.json",
761+
"codePipelineEvent.json",
762+
"codePipelineEventData.json",
763+
"codePipelineEventEmptyUserParameters.json",
764+
"codePipelineEventWithEncryptionKey.json",
765+
"cognitoCreateAuthChallengeEvent.json",
766+
"cognitoCustomEmailSenderEvent.json",
767+
"cognitoCustomMessageEvent.json",
768+
"cognitoCustomSMSSenderEvent.json",
769+
"cognitoDefineAuthChallengeEvent.json",
770+
"cognitoPostAuthenticationEvent.json",
771+
"cognitoPostConfirmationEvent.json",
772+
"cognitoPreAuthenticationEvent.json",
773+
"cognitoPreSignUpEvent.json",
774+
"cognitoPreTokenGenerationEvent.json",
775+
"cognitoPreTokenV2GenerationEvent.json",
776+
"cognitoUserMigrationEvent.json",
777+
"cognitoVerifyAuthChallengeResponseEvent.json",
778+
"connectContactFlowEventAll.json",
779+
"connectContactFlowEventMin.json",
780+
"dynamoStreamEvent.json",
781+
"eventBridgeEvent.json",
782+
"kafkaEventMsk.json",
783+
"kafkaEventSelfManaged.json",
784+
"kinesisFirehoseKinesisEvent.json",
785+
"kinesisFirehosePutEvent.json",
786+
"kinesisFirehoseSQSEvent.json",
787+
"kinesisStreamCloudWatchLogsEvent.json",
788+
"kinesisStreamEvent.json",
789+
"kinesisStreamEventOneRecord.json",
790+
"lambdaFunctionUrlEvent.json",
791+
"lambdaFunctionUrlEventPathTrailingSlash.json",
792+
"lambdaFunctionUrlEventWithHeaders.json",
793+
"lambdaFunctionUrlIAMEvent.json",
794+
"rabbitMQEvent.json",
795+
"s3BatchOperationEventSchemaV1.json",
796+
"s3BatchOperationEventSchemaV2.json",
797+
"s3Event.json",
798+
"s3EventBridgeNotificationObjectCreatedEvent.json",
799+
"s3EventBridgeNotificationObjectDeletedEvent.json",
800+
"s3EventBridgeNotificationObjectExpiredEvent.json",
801+
"s3EventBridgeNotificationObjectRestoreCompletedEvent.json",
802+
"s3EventDecodedKey.json",
803+
"s3EventDeleteObject.json",
804+
"s3EventGlacier.json",
805+
"s3ObjectEventIAMUser.json",
806+
"s3ObjectEventTempCredentials.json",
807+
"s3SqsEvent.json",
808+
"secretsManagerEvent.json",
809+
"sesEvent.json",
810+
"snsEvent.json",
811+
"snsSqsEvent.json",
812+
"snsSqsFifoEvent.json",
813+
"sqsDlqTriggerEvent.json",
814+
"sqsEvent.json",
815+
"vpcLatticeEvent.json",
816+
"vpcLatticeEventPathTrailingSlash.json",
817+
"vpcLatticeEventV2PathTrailingSlash.json",
818+
"vpcLatticeV2Event.json",
819+
"vpcLatticeV2EventWithHeaders.json",
820+
],
821+
)
822+
def test_match_for_not_cloud_watch_logs_event(self, event_name):
823+
event = load_event(file_name=event_name)
824+
route = CloudWatchLogsRoute(func=None, log_group="testLogGroup")
825+
actual = route.match(event=event)
826+
assert actual is None

tests/unit/event_handler/_async_execution/_routes/test_code_deploy_lifecycle_hook.py

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,117 @@ def test_match_false(self, event_name, option_constructor):
136136
route = CodeDeployLifecycleHookRoute(**option_constructor)
137137
actual = route.match(event=event)
138138
assert actual is None
139+
140+
@pytest.mark.parametrize(
141+
"event_name",
142+
[
143+
"activeMQEvent.json",
144+
"albEvent.json",
145+
"albEventPathTrailingSlash.json",
146+
"albMultiValueHeadersEvent.json",
147+
"albMultiValueQueryStringEvent.json",
148+
"apiGatewayAuthorizerRequestEvent.json",
149+
"apiGatewayAuthorizerTokenEvent.json",
150+
"apiGatewayAuthorizerV2Event.json",
151+
"apiGatewayProxyEvent.json",
152+
"apiGatewayProxyEventAnotherPath.json",
153+
"apiGatewayProxyEventNoOrigin.json",
154+
"apiGatewayProxyEventPathTrailingSlash.json",
155+
"apiGatewayProxyEventPrincipalId.json",
156+
"apiGatewayProxyEvent_noVersionAuth.json",
157+
"apiGatewayProxyOtherEvent.json",
158+
"apiGatewayProxyV2Event.json",
159+
"apiGatewayProxyV2EventPathTrailingSlash.json",
160+
"apiGatewayProxyV2Event_GET.json",
161+
"apiGatewayProxyV2IamEvent.json",
162+
"apiGatewayProxyV2LambdaAuthorizerEvent.json",
163+
"apiGatewayProxyV2OtherGetEvent.json",
164+
"apiGatewayProxyV2SchemaMiddlwareInvalidEvent.json",
165+
"apiGatewayProxyV2SchemaMiddlwareValidEvent.json",
166+
"apigatewayeSchemaMiddlwareInvalidEvent.json",
167+
"apigatewayeSchemaMiddlwareValidEvent.json",
168+
"appSyncAuthorizerEvent.json",
169+
"appSyncAuthorizerResponse.json",
170+
"appSyncBatchEvent.json",
171+
"appSyncDirectResolver.json",
172+
"appSyncResolverEvent.json",
173+
"awsConfigRuleConfigurationChanged.json",
174+
"awsConfigRuleOversizedConfiguration.json",
175+
"awsConfigRuleScheduled.json",
176+
"bedrockAgentEvent.json",
177+
"bedrockAgentEventWithPathParams.json",
178+
"bedrockAgentPostEvent.json",
179+
"cloudWatchAlarmEventCompositeMetric.json",
180+
"cloudWatchAlarmEventSingleMetric.json",
181+
"cloudWatchDashboardEvent.json",
182+
"cloudWatchLogEvent.json",
183+
"cloudWatchLogEventWithPolicyLevel.json",
184+
"cloudformationCustomResourceCreate.json",
185+
"cloudformationCustomResourceDelete.json",
186+
"cloudformationCustomResourceUpdate.json",
187+
"codePipelineEvent.json",
188+
"codePipelineEventData.json",
189+
"codePipelineEventEmptyUserParameters.json",
190+
"codePipelineEventWithEncryptionKey.json",
191+
"cognitoCreateAuthChallengeEvent.json",
192+
"cognitoCustomEmailSenderEvent.json",
193+
"cognitoCustomMessageEvent.json",
194+
"cognitoCustomSMSSenderEvent.json",
195+
"cognitoDefineAuthChallengeEvent.json",
196+
"cognitoPostAuthenticationEvent.json",
197+
"cognitoPostConfirmationEvent.json",
198+
"cognitoPreAuthenticationEvent.json",
199+
"cognitoPreSignUpEvent.json",
200+
"cognitoPreTokenGenerationEvent.json",
201+
"cognitoPreTokenV2GenerationEvent.json",
202+
"cognitoUserMigrationEvent.json",
203+
"cognitoVerifyAuthChallengeResponseEvent.json",
204+
"connectContactFlowEventAll.json",
205+
"connectContactFlowEventMin.json",
206+
"dynamoStreamEvent.json",
207+
"eventBridgeEvent.json",
208+
"kafkaEventMsk.json",
209+
"kafkaEventSelfManaged.json",
210+
"kinesisFirehoseKinesisEvent.json",
211+
"kinesisFirehosePutEvent.json",
212+
"kinesisFirehoseSQSEvent.json",
213+
"kinesisStreamCloudWatchLogsEvent.json",
214+
"kinesisStreamEvent.json",
215+
"kinesisStreamEventOneRecord.json",
216+
"lambdaFunctionUrlEvent.json",
217+
"lambdaFunctionUrlEventPathTrailingSlash.json",
218+
"lambdaFunctionUrlEventWithHeaders.json",
219+
"lambdaFunctionUrlIAMEvent.json",
220+
"rabbitMQEvent.json",
221+
"s3BatchOperationEventSchemaV1.json",
222+
"s3BatchOperationEventSchemaV2.json",
223+
"s3Event.json",
224+
"s3EventBridgeNotificationObjectCreatedEvent.json",
225+
"s3EventBridgeNotificationObjectDeletedEvent.json",
226+
"s3EventBridgeNotificationObjectExpiredEvent.json",
227+
"s3EventBridgeNotificationObjectRestoreCompletedEvent.json",
228+
"s3EventDecodedKey.json",
229+
"s3EventDeleteObject.json",
230+
"s3EventGlacier.json",
231+
"s3ObjectEventIAMUser.json",
232+
"s3ObjectEventTempCredentials.json",
233+
"s3SqsEvent.json",
234+
"secretsManagerEvent.json",
235+
"sesEvent.json",
236+
"snsEvent.json",
237+
"snsSqsEvent.json",
238+
"snsSqsFifoEvent.json",
239+
"sqsDlqTriggerEvent.json",
240+
"sqsEvent.json",
241+
"vpcLatticeEvent.json",
242+
"vpcLatticeEventPathTrailingSlash.json",
243+
"vpcLatticeEventV2PathTrailingSlash.json",
244+
"vpcLatticeV2Event.json",
245+
"vpcLatticeV2EventWithHeaders.json",
246+
],
247+
)
248+
def test_match_for_not_code_deploy_lifecycle_hook_event(self, event_name):
249+
event = load_event(file_name=event_name)
250+
route = CodeDeployLifecycleHookRoute(func=None)
251+
actual = route.match(event=event)
252+
assert actual is None

0 commit comments

Comments
 (0)