don't use global s3 client

This commit is contained in:
Kenneth Kehl
2025-06-27 13:01:30 -07:00
parent 123a379f73
commit ac7ba7a95d

View File

@@ -615,34 +615,23 @@ def test_get_s3_client_default_credentials():
mock_session.return_value.client.assert_called_once_with( mock_session.return_value.client.assert_called_once_with(
"s3", "s3",
config=ANY, config=ANY,
aws_access_id=None,
aws_secret_access_key=None, # pragma: allowlist secret
region_name="us-north-1",
) )
# def test_get_s3_client_invalid_credentials(): def test_get_s3_client_invalid_credentials():
# with patch.dict(
# os.environ, with patch("app.aws.s3.Session") as mock_session:
# { mock_session.return_value.client.side_effect = botocore.exceptions.ClientError(
# "AWS_ACCESS_KEY_ID": "invalid-key", {
# "AWS_SECRET_ACCESS_KEY": "invalid-secret", # pragma: allowlist secret "Error": {
# "AWS_DEFAULT_REGION": "us-north-1", "Code": "InvalidClientTokenId",
# }, "Message": "Invalid credentials",
# ): }
# with patch("boto3.client", side_effect = ( },
# botocore.exceptions.ClientError( "HeadBucket",
# { )
# "Error": { try:
# "Code": "InvalidClientTokenId", get_s3_client()
# "Message": "Invalid credentials", assert 1 == 0
# } except botocore.exceptions.ClientError as e:
# }, assert e.response["Error"]["Code"] == "InvalidClientTokenId"
# "GetObject",
# )
# )
# try:
# get_s3_client()
# assert 1 == 0
# except botocore.exceptions.ClientError as e:
# assert e.response["Error"]["Code"] == "InvalidClientTokenId"