From c7a2a21a2639696cdab64b7e3d02519d65b1b955 Mon Sep 17 00:00:00 2001 From: Gavin Zhang Date: Wed, 27 Sep 2023 17:15:47 -0700 Subject: [PATCH] Update unit tests --- tests/model/eventsources/test_sns_event_source.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/model/eventsources/test_sns_event_source.py b/tests/model/eventsources/test_sns_event_source.py index b2f17660b0..71dfa4805c 100644 --- a/tests/model/eventsources/test_sns_event_source.py +++ b/tests/model/eventsources/test_sns_event_source.py @@ -18,8 +18,10 @@ def setUp(self): self.function.get_passthrough_resource_attributes = Mock() self.function.get_passthrough_resource_attributes.return_value = {} + self.kwargs = {"function": self.function, "intrinsics_resolver": Mock()} + def test_to_cloudformation_returns_permission_and_subscription_resources(self): - resources = self.sns_event_source.to_cloudformation(function=self.function) + resources = self.sns_event_source.to_cloudformation(**self.kwargs) self.assertEqual(len(resources), 2) self.assertEqual(resources[0].resource_type, "AWS::Lambda::Permission") self.assertEqual(resources[1].resource_type, "AWS::SNS::Subscription") @@ -37,7 +39,7 @@ def test_to_cloudformation_passes_the_region(self): region = "us-west-2" self.sns_event_source.Region = region - resources = self.sns_event_source.to_cloudformation(function=self.function) + resources = self.sns_event_source.to_cloudformation(**self.kwargs) self.assertEqual(len(resources), 2) self.assertEqual(resources[1].resource_type, "AWS::SNS::Subscription") subscription = resources[1] @@ -51,7 +53,7 @@ def test_to_cloudformation_passes_the_filter_policy(self): } self.sns_event_source.FilterPolicy = filterPolicy - resources = self.sns_event_source.to_cloudformation(function=self.function) + resources = self.sns_event_source.to_cloudformation(**self.kwargs) self.assertEqual(len(resources), 2) self.assertEqual(resources[1].resource_type, "AWS::SNS::Subscription") subscription = resources[1] @@ -61,7 +63,7 @@ def test_to_cloudformation_passes_the_filter_policy_scope(self): filterPolicyScope = "MessageAttributes" self.sns_event_source.FilterPolicyScope = filterPolicyScope - resources = self.sns_event_source.to_cloudformation(function=self.function) + resources = self.sns_event_source.to_cloudformation(**self.kwargs) self.assertEqual(len(resources), 2) self.assertEqual(resources[1].resource_type, "AWS::SNS::Subscription") subscription = resources[1] @@ -71,7 +73,7 @@ def test_to_cloudformation_passes_the_redrive_policy(self): redrive_policy = {"deadLetterTargetArn": "arn:aws:sqs:us-east-2:123456789012:MyDeadLetterQueue"} self.sns_event_source.RedrivePolicy = redrive_policy - resources = self.sns_event_source.to_cloudformation(function=self.function) + resources = self.sns_event_source.to_cloudformation(**self.kwargs) self.assertEqual(len(resources), 2) self.assertEqual(resources[1].resource_type, "AWS::SNS::Subscription") subscription = resources[1] @@ -89,7 +91,7 @@ def test_to_cloudformation_when_sqs_subscription_disable(self): sqsSubscription = False self.sns_event_source.SqsSubscription = sqsSubscription - resources = self.sns_event_source.to_cloudformation(function=self.function) + resources = self.sns_event_source.to_cloudformation(**self.kwargs) self.assertEqual(len(resources), 2) self.assertEqual(resources[0].resource_type, "AWS::Lambda::Permission") self.assertEqual(resources[1].resource_type, "AWS::SNS::Subscription")