本文整理汇总了Python中tests.unit.customizations.s3.list_contents函数的典型用法代码示例。如果您正苦于以下问题:Python list_contents函数的具体用法?Python list_contents怎么用?Python list_contents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了list_contents函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_delete_url_encode
def test_delete_url_encode(self):
key = self.bucket + '/a+b/foo'
tasks = [FileInfo(src=key, src_type='s3',
dest_type='local', operation='delete', size=0)]
self.assertEqual(len(list_contents(self.bucket, self.session)), 1)
self.s3_handler.call(tasks)
self.assertEqual(len(list_contents(self.bucket, self.session)), 0)
开发者ID:TarantulaTechnology,项目名称:aws,代码行数:7,代码来源:test_s3handler.py
示例2: test_s3_delete
def test_s3_delete(self):
"""
Tests S3 deletes. The files used are the same generated from
filegenerators_test.py. This includes the create s3 file.
"""
keys = [
self.bucket + "/another_directory/text2.txt",
self.bucket + "/text1.txt",
self.bucket + "/another_directory/",
]
tasks = []
for key in keys:
tasks.append(
FileInfo(
src=key,
src_type="s3",
dest_type="local",
operation_name="delete",
size=0,
service=self.service,
endpoint=self.endpoint,
)
)
self.assertEqual(len(list_contents(self.bucket, self.session)), 3)
self.s3_handler.call(tasks)
self.assertEqual(len(list_contents(self.bucket, self.session)), 0)
开发者ID:viglesiasce,项目名称:aws-cli,代码行数:26,代码来源:test_s3handler.py
示例3: test_s3_delete_url_encode
def test_s3_delete_url_encode(self):
"""
Tests S3 deletes. The files used are the same generated from
filegenerators_test.py. This includes the create s3 file.
"""
key = self.bucket + '/a+b/foo'
tasks = [FileInfo(src=key, src_type='s3', dest_type='local', operation='delete', size=0)]
self.assertEqual(len(list_contents(self.bucket, self.session)), 1)
self.s3_handler.call(tasks)
self.assertEqual(len(list_contents(self.bucket, self.session)), 0)
开发者ID:TarantulaTechnology,项目名称:aws,代码行数:10,代码来源:test_s3handler.py
示例4: test_move_unicode
def test_move_unicode(self):
# Confirm there are no objects in the bucket.
self.assertEqual(len(list_contents(self.bucket2, self.session)), 0)
# Create file info objects to perform move.
tasks = []
for i in range(len(self.s3_files)):
tasks.append(FileInfo(src=self.s3_files[i], src_type='s3',
dest=self.s3_files2[i], dest_type='s3',
operation='move', size=0))
# Perform the move.
self.s3_handler.call(tasks)
self.assertEqual(len(list_contents(self.bucket2, self.session)), 1)
开发者ID:TarantulaTechnology,项目名称:aws,代码行数:12,代码来源:test_s3handler.py
示例5: test_upload
def test_upload(self):
# Confirm there are no objects in the bucket.
self.assertEqual(len(list_contents(self.bucket, self.session)), 0)
# Create file info objects to perform upload.
files = [self.loc_files[0], self.loc_files[1]]
tasks = []
for i in range(len(files)):
tasks.append(FileInfo(src=self.loc_files[i],
dest=self.s3_files[i],
operation='upload', size=0))
# Perform the upload.
self.s3_handler.call(tasks)
# Confirm despite the exceptions, the files were uploaded.
self.assertEqual(len(list_contents(self.bucket, self.session)), 2)
开发者ID:50onRed,项目名称:aws-cli,代码行数:14,代码来源:test_s3handler.py
示例6: test_s3_delete
def test_s3_delete(self):
"""
Tests S3 deletes. The files used are the same generated from
filegenerators_test.py. This includes the create s3 file.
"""
keys = [self.bucket + '/another_directory/text2.txt',
self.bucket + '/text1.txt',
self.bucket + '/another_directory/']
tasks = []
for key in keys:
tasks.append(FileInfo(src=key, src_type='s3',
dest_type='local', operation='delete',
size=0))
self.assertEqual(len(list_contents(self.bucket, self.session)), 3)
self.s3_handler.call(tasks)
self.assertEqual(len(list_contents(self.bucket, self.session)), 0)
开发者ID:50onRed,项目名称:aws-cli,代码行数:16,代码来源:test_s3handler.py
示例7: test_delete_url_encode
def test_delete_url_encode(self):
key = self.bucket + "/a+b/foo"
tasks = [
FileInfo(
src=key,
src_type="s3",
dest_type="local",
operation_name="delete",
size=0,
service=self.service,
endpoint=self.endpoint,
)
]
self.assertEqual(len(list_contents(self.bucket, self.session)), 1)
self.s3_handler.call(tasks)
self.assertEqual(len(list_contents(self.bucket, self.session)), 0)
开发者ID:viglesiasce,项目名称:aws-cli,代码行数:16,代码来源:test_s3handler.py
示例8: test_upload_fail
def test_upload_fail(self):
"""
One of the uploads will fail to upload in this test as
the second s3 destination's bucket does not exist.
"""
self.assertEqual(len(list_contents(self.bucket, self.session)), 0)
fail_s3_files = [self.bucket + '/text1.txt',
self.bucket[:-1] + '/another_directory/text2.txt']
files = [self.loc_files[0], self.loc_files[1]]
tasks = []
for i in range(len(files)):
tasks.append(FileInfo(src=self.loc_files[i],
dest=fail_s3_files[i],
operation='upload', size=0))
self.s3_handler.call(tasks)
# Confirm only one of the files was uploaded.
self.assertEqual(len(list_contents(self.bucket, self.session)), 1)
开发者ID:50onRed,项目名称:aws-cli,代码行数:17,代码来源:test_s3handler.py
示例9: test_upload
def test_upload(self):
"""
Test the abiltiy to upload a file without the use of threads.
"""
# Confirm there are no objects in the bucket.
self.assertEqual(len(list_contents(self.bucket, self.session)), 0)
# Create file info objects to perform upload.
files = [self.loc_files[0], self.loc_files[1]]
tasks = []
for i in range(len(files)):
tasks.append(FileInfo(src=self.loc_files[i],
dest=self.s3_files[i],
operation='upload', size=0))
# Perform the upload.
self.s3_handler.call(tasks)
# Confirm the files were uploaded.
self.assertEqual(len(list_contents(self.bucket, self.session)), 2)
开发者ID:2mind,项目名称:aws-cli,代码行数:17,代码来源:test_s3handler.py
示例10: test_move
def test_move(self):
# Confirm there are no objects in the bucket.
self.assertEqual(len(list_contents(self.bucket2, self.session)), 0)
# Create file info objects to perform move.
tasks = []
for i in range(len(self.s3_files)):
tasks.append(FileInfo(
src=self.s3_files[i], src_type='s3',
dest=self.s3_files2[i], dest_type='s3',
operation_name='move', size=0,
service=self.service,
endpoint=self.endpoint))
# Perform the move.
self.s3_handler.call(tasks)
# Confirm the files were moved. The origial bucket had three
# objects. Only two were moved.
self.assertEqual(len(list_contents(self.bucket, self.session)), 1)
self.assertEqual(len(list_contents(self.bucket2, self.session)), 2)
开发者ID:SydOps,项目名称:aws-cli,代码行数:18,代码来源:test_s3handler.py
示例11: test_move_unicode
def test_move_unicode(self):
self.bucket2 = make_s3_files(self.session, key1=u'\u2713')
tasks = [FileInfo(src=self.bucket2 + '/' + u'\u2713',
src_type='s3',
dest=self.bucket + '/' + u'\u2713',
dest_type='s3', operation='move',
size=0)]
self.s3_handler.call(tasks)
self.assertEqual(len(list_contents(self.bucket, self.session)), 1)
开发者ID:TarantulaTechnology,项目名称:aws,代码行数:9,代码来源:test_s3handler.py
示例12: test_move
def test_move(self):
# Create file info objects to perform move.
files = [self.loc_files[0], self.loc_files[1]]
tasks = []
for i in range(len(files)):
tasks.append(FileInfo(src=self.loc_files[i], src_type='local',
dest=self.s3_files[i], dest_type='s3',
operation='move', size=0))
# Perform the move.
self.s3_handler.call(tasks)
# Confirm the files were uploaded.
self.assertEqual(len(list_contents(self.bucket, self.session)), 2)
# Confirm local files do not exist.
for filename in files:
self.assertFalse(os.path.exists(filename))
开发者ID:50onRed,项目名称:aws-cli,代码行数:15,代码来源:test_s3handler.py
注:本文中的tests.unit.customizations.s3.list_contents函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论