Skip to content

Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.

fix(s3): tests (#1240)

Nahuel Nucerad5f42f4743e2
diff --git a/tests/test_acm.py b/tests/test_acm.py
index 48ca0c3d..5e9fdda6 100644
--- a/tests/test_acm.py
+++ b/tests/test_acm.py
@@ -517,10 +517,10 @@ def test_get_state_preserves_certs_across_all_tenants():
persisted = snapshot["_certificates"]
raw_keys = list(persisted._data.keys())
- accounts_persisted = {acct for acct, _ in raw_keys}
+ accounts_persisted = {acct for acct, *_ in raw_keys}
assert accounts_persisted == {"111111111111", "222222222222"}, (
"get_state() dropped a tenant's certs from the snapshot — only "
- f"persisted accounts: {accounts_persisted}. AccountScopedDict.items() "
+ f"persisted accounts: {accounts_persisted}. AccountRegionScopedDict.items() "
"is request-scoped; iterating _data is required to capture all "
"tenants."
)
diff --git a/tests/test_s3.py b/tests/test_s3.py
index 03a21676..d3ac434d 100644
--- a/tests/test_s3.py
+++ b/tests/test_s3.py
@@ -2265,9 +2265,12 @@ def test_s3_bucket_encryption(s3):
rules = resp["ServerSideEncryptionConfiguration"]["Rules"]
assert rules[0]["ApplyServerSideEncryptionByDefault"]["SSEAlgorithm"] == "AES256"
s3.delete_bucket_encryption(Bucket="intg-s3-enc")
- with pytest.raises(ClientError) as exc:
- s3.get_bucket_encryption(Bucket="intg-s3-enc")
- assert exc.value.response["Error"]["Code"] == "ServerSideEncryptionConfigurationNotFoundError"
+ # Since 5 Jan 2023 every bucket has SSE-S3 default encryption, so after
+ # deletion GetBucketEncryption returns the AES256 default instead of raising
+ # ServerSideEncryptionConfigurationNotFoundError.
+ default = s3.get_bucket_encryption(Bucket="intg-s3-enc")
+ default_rules = default["ServerSideEncryptionConfiguration"]["Rules"]
+ assert default_rules[0]["ApplyServerSideEncryptionByDefault"]["SSEAlgorithm"] == "AES256"
def test_s3_bucket_lifecycle(s3):
s3.create_bucket(Bucket="intg-s3-lifecycle")