def test_create_download_cmd_unzip_bz2_dir(mocker): mocker.patch('awsf3.utils.determine_key_type', return_value='Folder') dc_cmd = create_download_cmd('somebucket', 'somedir', 'sometarget', '', 'gz') right_cmd = ('aws s3 cp --recursive s3://somebucket/somedir sometarget; ' 'for f in `find sometarget -type f`; ' 'do if [[ $f =~ \\.gz$ ]]; then gunzip $f; fi; done;') assert dc_cmd == right_cmd
def test_create_download_cmd_nounzip_profile_dir(mocker): mocker.patch('awsf3.utils.determine_key_type', return_value='Folder') dc_cmd = create_download_cmd('somebucket', 'somedir', 'sometarget', 'user1', '') assert dc_cmd == 'aws s3 cp --recursive s3://somebucket/somedir sometarget --profile user1; '
def test_create_download_cmd_nounzip_profile(mocker): mocker.patch('awsf3.utils.determine_key_type', return_value='File') dc_cmd = create_download_cmd('somebucket', 'somefile.gz', 'sometarget.gz', 'user1', '') assert dc_cmd == 'aws s3 cp s3://somebucket/somefile.gz sometarget.gz --profile user1; '
def test_create_download_cmd_unzip_bz2(mocker): mocker.patch('awsf3.utils.determine_key_type', return_value='File') dc_cmd = create_download_cmd('somebucket', 'somefile.gz', 'sometarget.gz', '', 'gz') assert dc_cmd == 'aws s3 cp s3://somebucket/somefile.gz sometarget.gz; gunzip sometarget.gz'