From 24b481457015706d68e57e851bfeb173306a3a4b Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Fri, 10 Nov 2023 09:42:43 -0700 Subject: [PATCH] TST: Update s3 bucket tests for latest cdk updates The cdk added PutBucketPolicy to their list of actions when creating the cloudformation. --- .../test_backup_bucket_stack.py | 8 +++++-- .../infrastructure/test_data_manager_stack.py | 21 ++++++++++++++++--- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/tests/infrastructure/test_backup_bucket_stack.py b/tests/infrastructure/test_backup_bucket_stack.py index 882eeaf1..023881cf 100644 --- a/tests/infrastructure/test_backup_bucket_stack.py +++ b/tests/infrastructure/test_backup_bucket_stack.py @@ -29,7 +29,6 @@ def test_s3_config_bucket_resource_properties(template): "UpdateReplacePolicy": "Delete", }, ) - template.has_resource_properties( "AWS::S3::Bucket", { @@ -58,7 +57,12 @@ def test_s3_data_bucket_policy_resource_properties(template): "Version": "2012-10-17", "Statement": [ { - "Action": ["s3:GetBucket*", "s3:List*", "s3:DeleteObject*"], + "Action": [ + "s3:PutBucketPolicy", + "s3:GetBucket*", + "s3:List*", + "s3:DeleteObject*", + ], "Effect": "Allow", "Principal": { "AWS": { diff --git a/tests/infrastructure/test_data_manager_stack.py b/tests/infrastructure/test_data_manager_stack.py index 657f77e0..d5c2081b 100644 --- a/tests/infrastructure/test_data_manager_stack.py +++ b/tests/infrastructure/test_data_manager_stack.py @@ -123,7 +123,12 @@ def test_s3_data_bucket_policy_resource_properties(template): "Version": "2012-10-17", "Statement": [ { - "Action": ["s3:GetBucket*", "s3:List*", "s3:DeleteObject*"], + "Action": [ + "s3:PutBucketPolicy", + "s3:GetBucket*", + "s3:List*", + "s3:DeleteObject*", + ], "Effect": "Allow", "Principal": { "AWS": { @@ -172,7 +177,12 @@ def test_s3_config_bucket_policy_resource_properties(template): "PolicyDocument": { "Statement": [ { - "Action": ["s3:GetBucket*", "s3:List*", "s3:DeleteObject*"], + "Action": [ + "s3:PutBucketPolicy", + "s3:GetBucket*", + "s3:List*", + "s3:DeleteObject*", + ], "Effect": "Allow", "Principal": { "AWS": { @@ -224,7 +234,12 @@ def test_s3_snapshot_bucket_policy_resource_properties(template): "PolicyDocument": { "Statement": [ { - "Action": ["s3:GetBucket*", "s3:List*", "s3:DeleteObject*"], + "Action": [ + "s3:PutBucketPolicy", + "s3:GetBucket*", + "s3:List*", + "s3:DeleteObject*", + ], "Effect": "Allow", "Principal": { "AWS": {