Two days ago, I discovered a small bug in the moto library that I use to unit test my lambdas on AWS. I needed to create an S3 Access Point with boto3, and while retrieving the its alias, I had different results when using the return value of create_access_point or get_access_point.
So I wrote a small unit test:
from moto import mock_s3control
import boto3
@mock_s3control
def test_access_point_alias():
client = boto3.client("s3control")
alias_from_create = client.create_access_point(
AccountId="123456789012",
Name="my-access-point",
Bucket="MyBucket",
)["Alias"]
alias_from_get = client.get_access_point(
AccountId="123456789012",
Name="my-access-point",
)["Alias"]
assert alias_from_create == alias_from_get
I create an S3 Access Point, and retrieve its alias in two ways: from the response of the create_access_point function, and from the get_access_point function. On my moto 4.2.6, this test fails.
So I opened an issue on the project's repository. It was fixed and closed on the same day. That's reactivity!
No comments:
Post a Comment