implemented s3 default encryption methods (#3022)
* implemented s3 default encryption methods * PR adjustments: moved logic for retrieving bucket's encrypted status to the backend. Co-authored-by: Joseph Weitekamp <jweite@amazon.com>
This commit is contained in:
parent
b7a1b666a8
commit
4d3e3c8c5e
3 changed files with 104 additions and 1 deletions
|
|
@ -4521,3 +4521,36 @@ def test_creating_presigned_post():
|
|||
].read()
|
||||
== fdata
|
||||
)
|
||||
|
||||
|
||||
@mock_s3
|
||||
def test_encryption():
|
||||
# Create Bucket so that test can run
|
||||
conn = boto3.client("s3", region_name="us-east-1")
|
||||
conn.create_bucket(Bucket="mybucket")
|
||||
|
||||
with assert_raises(ClientError) as exc:
|
||||
conn.get_bucket_encryption(Bucket="mybucket")
|
||||
|
||||
sse_config = {
|
||||
"Rules": [
|
||||
{
|
||||
"ApplyServerSideEncryptionByDefault": {
|
||||
"SSEAlgorithm": "aws:kms",
|
||||
"KMSMasterKeyID": "12345678",
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
conn.put_bucket_encryption(
|
||||
Bucket="mybucket", ServerSideEncryptionConfiguration=sse_config
|
||||
)
|
||||
|
||||
resp = conn.get_bucket_encryption(Bucket="mybucket")
|
||||
assert "ServerSideEncryptionConfiguration" in resp
|
||||
assert resp["ServerSideEncryptionConfiguration"] == sse_config
|
||||
|
||||
conn.delete_bucket_encryption(Bucket="mybucket")
|
||||
with assert_raises(ClientError) as exc:
|
||||
conn.get_bucket_encryption(Bucket="mybucket")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue