"""Test utils.""" from tempfile import TemporaryDirectory import unittest.mock from src import utils @unittest.mock.patch.object(utils, 'boto3') def test_download_s3_url(boto3_mock): """Test download_s3_url.""" with TemporaryDirectory() as dir: result = utils.download_from_s3_url( bucket='abucket', key='some/path/filename.txt', dir=dir ) assert result == dir + '/filename.txt' assert boto3_mock.client.called assert boto3_mock.client.return_value.download_file.call_args_list == [ unittest.mock.call( 'abucket', 'some/path/filename.txt', dir + '/filename.txt')]