Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_pass_credentials(self, mocker):
"""Test that AWS credentials are passed successfully into boto3
client instantiation on creating S3 connection."""
mocker.patch("s3fs.core.boto3.Session.client")
s3_data_set = CSVS3DataSet(
filepath=FILENAME, bucket_name=BUCKET_NAME, credentials=AWS_CREDENTIALS
)
pattern = r"Failed while loading data from data set CSVS3DataSet\(.+\)"
with pytest.raises(DataSetError, match=pattern):
s3_data_set.load()
assert s3fs.core.boto3.Session.client.call_count == 1
args, kwargs = s3fs.core.boto3.Session.client.call_args_list[0]
assert args == ("s3",)
for k, v in AWS_CREDENTIALS.items():
assert kwargs[k] == v
def test_pass_credentials(self, mocker):
"""Test that AWS credentials are passed successfully into boto3
client instantiation on creating S3 connection."""
mocker.patch("s3fs.core.boto3.Session.client")
s3_data_set = PickleS3DataSet(
filepath=FILENAME, bucket_name=BUCKET_NAME, credentials=AWS_CREDENTIALS
)
pattern = r"Failed while loading data from data set PickleS3DataSet\(.+\)"
with pytest.raises(DataSetError, match=pattern):
s3_data_set.load()
assert s3fs.core.boto3.Session.client.call_count == 1
args, kwargs = s3fs.core.boto3.Session.client.call_args_list[0]
assert args == ("s3",)
for k, v in AWS_CREDENTIALS.items():
assert kwargs[k] == v
def test_pass_credentials(self, mocker):
"""Test that AWS credentials are passed successfully into boto3
client instantiation on creating S3 connection."""
mocker.patch("s3fs.core.boto3.Session.client")
s3_data_set = ParquetS3DataSet(
filepath=FILENAME, bucket_name=BUCKET_NAME, credentials=AWS_CREDENTIALS
)
pattern = r"Failed while loading data from data set ParquetS3DataSet\(.+\)"
with pytest.raises(DataSetError, match=pattern):
s3_data_set.load()
assert s3fs.core.boto3.Session.client.call_count == 1
args, kwargs = s3fs.core.boto3.Session.client.call_args_list[0]
assert args == ("s3",)
for k, v in AWS_CREDENTIALS.items():
assert kwargs[k] == v