def test_s3_download(resource, url, bucket_name, key, dst): region = 'us-west-2' os.environ[_params.REGION_NAME_ENV] = region _modules.s3_download(url, dst) chain = call('s3', region_name=region).Bucket(bucket_name).download_file(key, dst) assert resource.mock_calls == chain.call_list()
def test_s3_download_wrong_scheme(): with pytest.raises(ValueError, message="Expecting 's3' scheme, got: c in c://my-bucket/my-file"): _modules.s3_download('c://my-bucket/my-file', '/tmp/file')
def test_s3_download(resource, url, bucket_name, key, dst): _modules.s3_download(url, dst) chain = call('s3').Bucket(bucket_name).download_file(key, dst) assert resource.mock_calls == chain.call_list()