I'm using boto3 to load some file from an AWS S3 bucket. Which is working fine. However for my unittests i'm calling freeze_time and then the function returns the error: botocore.exceptions.ClientError: An error occurred (403) when calling the HeadObject operation: Forbidden
.
Is there a solution, which enables me to keep using freeze_time and which will retreive the file from S3?
The code works without @freeze_time("2019-01-30")
and doesn't when added.
import boto3
from freezegun import freeze_time
import io
bucket = 'bucket'
key = 'key'
@freeze_time("2019-01-30")
def test_x():
s3 = boto3.client('s3')
f = io.BytesIO()
s3.download_fileobj(bucket, key, f)
test_x()