def test_bucket_put_file(self): with patch("quilt3.bucket.copy_file") as copy_mock: bucket = Bucket('s3://test-bucket') bucket.put_file(key='README.md', path='./README') # put local file to bucket copy_mock.assert_called_once_with( PhysicalKey.from_path('README'), PhysicalKey.from_url('s3://test-bucket/README.md'))
def test_bucket_put_file(self): with patch("quilt3.bucket.copy_file") as copy_mock: bucket = Bucket('s3://test-bucket') bucket.put_file(key='README.md', path='./README') # put local file to bucket copy_src = copy_mock.call_args_list[0][0][0] assert urlparse(copy_src).scheme == 'file' copy_dest = copy_mock.call_args_list[0][0][1] assert urlparse(copy_dest).scheme == 's3'
def test_bucket_put_file(self): with patch("quilt3.bucket.copy_file") as copy_mock: bucket = Bucket('s3://test-bucket') bucket.put_file(key='README.md', path='./README') # put local file to bucket copy_src = copy_mock.call_args_list[0][0][0] assert urlparse(copy_src).scheme == 'file' copy_dest = copy_mock.call_args_list[0][0][1] assert urlparse(copy_dest).scheme == 's3' copy_mock.reset_mock() test_meta = {'asdf': 'jkl;'} expected_meta = {'user_meta': test_meta} bucket.put_file(key='README.md', path='./README', meta=test_meta) (src, dest, meta) = copy_mock.call_args_list[0][0] assert meta == expected_meta