Skip to content

Commit

Permalink
BlockPublicPolicy: add test when policy has principal
Browse files Browse the repository at this point in the history
  • Loading branch information
clwluvw committed Jul 19, 2024
1 parent 93a3b6c commit a83396c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions s3tests_boto3/functional/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -12984,6 +12984,23 @@ def test_block_public_policy():
check_access_denied(client.put_bucket_policy, Bucket=bucket_name, Policy=policy_document)


def test_block_public_policy_with_principal():
bucket_name = get_new_bucket()
client = get_client()

access_conf = {'BlockPublicAcls': False,
'IgnorePublicAcls': False,
'BlockPublicPolicy': True,
'RestrictPublicBuckets': False}

client.put_public_access_block(Bucket=bucket_name, PublicAccessBlockConfiguration=access_conf)
resource = _make_arn_resource("{}/{}".format(bucket_name, "*"))
policy_document = make_json_policy("s3:GetObject",
resource, principal={"AWS": "arn:aws:iam::s3tenant1:root"})

client.put_bucket_policy(Bucket=bucket_name, Policy=policy_document)


def test_ignore_public_acls():
bucket_name = get_new_bucket()
client = get_client()
Expand Down

0 comments on commit a83396c

Please sign in to comment.