Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffa committed Apr 27, 2023
1 parent d7e027d commit fab8eaa
Showing 1 changed file with 25 additions and 28 deletions.
53 changes: 25 additions & 28 deletions tests/translator/test_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,11 +856,9 @@ def get_managed_policy_map():
# test to make sure with arn it doesnt load, with non-arn it does
@parameterized.expand(
[
([""], 1),
(["SomeNonArnThing"], 1),
(["SomeNonArnThing", "AnotherNonArnThing"], 1),
(["aws:looks:like:an:ARN:but-not-really"], 1),
(["arn:looks:like:an:ARN:foo", "Mixing_things_v2"], 1),
(["AmazonS3FullAccess"], 0),
(["AmazonS3FullAccess", "AmazonSNSRole"], 0),
(["arn:looks:like:an:ARN:foo", "AmazonSQSFullAccess"], 0),
(["arn:looks:like:an:ARN:foo"], 0),
([{"Ref": "Foo"}], 0),
([{"SQSPollerPolicy": {"QueueName": "Bar"}}], 0),
Expand All @@ -880,31 +878,30 @@ def load(self):

managed_policy_loader = ManagedPolicyLoader()

with patch("samtranslator.internal.managed_policies._BUNDLED_MANAGED_POLICIES", {}):
transform(
{
"Resources": {
"MyFunction": {
"Type": "AWS::Serverless::Function",
"Properties": {
"Handler": "foo",
"InlineCode": "bar",
"Runtime": "nodejs14.x",
"Policies": policies,
},
transform(
{
"Resources": {
"MyFunction": {
"Type": "AWS::Serverless::Function",
"Properties": {
"Handler": "foo",
"InlineCode": "bar",
"Runtime": "nodejs14.x",
"Policies": policies,
},
"MyStateMachine": {
"Type": "AWS::Serverless::StateMachine",
"Properties": {
"DefinitionUri": "s3://egg/baz",
"Policies": policies,
},
},
"MyStateMachine": {
"Type": "AWS::Serverless::StateMachine",
"Properties": {
"DefinitionUri": "s3://egg/baz",
"Policies": policies,
},
}
},
{},
managed_policy_loader,
)
},
}
},
{},
managed_policy_loader,
)

self.assertEqual(load_policy_count, managed_policy_loader.call_count)

Expand Down

0 comments on commit fab8eaa

Please sign in to comment.