当前位置: 首页>>代码示例>>Python>>正文


Python Minio._list_object_parts方法代码示例

本文整理汇总了Python中minio.Minio._list_object_parts方法的典型用法代码示例。如果您正苦于以下问题:Python Minio._list_object_parts方法的具体用法?Python Minio._list_object_parts怎么用?Python Minio._list_object_parts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在minio.Minio的用法示例。


在下文中一共展示了Minio._list_object_parts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_empty_list_parts_works

# 需要导入模块: from minio import Minio [as 别名]
# 或者: from minio.Minio import _list_object_parts [as 别名]
    def test_empty_list_parts_works(self, mock_connection):
        mock_data = '''<?xml version="1.0"?>
                       <ListPartsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
                         <Bucket>bucket</Bucket>
                         <Key>go1.4.2</Key>
                         <UploadId>ntWSjzBytPT2xKLaMRonzXncsO10EH4Fc-Iq2-4hG-ulRYB</UploadId>
                         <Initiator>
                           <ID>minio</ID>
                           <DisplayName>minio</DisplayName>
                         </Initiator>
                         <Owner>
                           <ID>minio</ID>
                           <DisplayName>minio</DisplayName>
                         </Owner>
                         <StorageClass>STANDARD</StorageClass>
                         <PartNumberMarker>0</PartNumberMarker>
                         <NextPartNumberMarker>0</NextPartNumberMarker>
                         <MaxParts>1000</MaxParts>
                         <IsTruncated>false</IsTruncated>
                       </ListPartsResult>
                    '''
        mock_server = MockConnection()
        mock_connection.return_value = mock_server
        mock_server.mock_add_request(
            MockResponse('GET',
                         'https://localhost:9000/bucket/key?max-parts=1000&uploadId=upload_id',
                         {'User-Agent': _DEFAULT_USER_AGENT}, 200, content=mock_data))

        client = Minio('localhost:9000')
        part_iter = client._list_object_parts('bucket', 'key', 'upload_id')
        parts = []
        for part in part_iter:
            parts.append(part)
        eq_(0, len(parts))
开发者ID:bacongobbler,项目名称:minio-py,代码行数:36,代码来源:list_uploaded_parts_test.py

示例2: test_list_objects_works

# 需要导入模块: from minio import Minio [as 别名]
# 或者: from minio.Minio import _list_object_parts [as 别名]
    def test_list_objects_works(self, mock_connection):
        mock_data1 = '''<?xml version="1.0"?>
                        <ListPartsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
                          <Bucket>bucket</Bucket>
                          <Key>go1.4.2</Key>
                          <UploadId>ntWSjzBytPT2xKLaMRonzXncsO10EH4Fc-Iq2-4hG-ulRYB</UploadId>
                          <Initiator>
                            <ID>minio</ID>
                            <DisplayName>minio</DisplayName>
                          </Initiator>
                          <Owner>
                            <ID>minio</ID>
                            <DisplayName>minio</DisplayName>
                          </Owner>
                          <StorageClass>STANDARD</StorageClass>
                          <PartNumberMarker>0</PartNumberMarker>
                          <NextPartNumberMarker>2</NextPartNumberMarker>
                          <MaxParts>1000</MaxParts>
                          <IsTruncated>true</IsTruncated>
                          <Part>
                            <PartNumber>1</PartNumber>
                            <ETag>79b281060d337b9b2b84ccf390adcf74</ETag>
                            <LastModified>2015-06-03T03:12:34.756Z</LastModified>
                            <Size>5242880</Size>
                          </Part>
                          <Part>
                            <PartNumber>2</PartNumber>
                            <ETag>79b281060d337b9b2b84ccf390adcf74</ETag>
                            <LastModified>2015-06-03T03:12:34.756Z</LastModified>
                            <Size>5242880</Size>
                          </Part>
                        </ListPartsResult>
                        '''
        mock_data2 = '''<?xml version="1.0"?>
                        <ListPartsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
                          <Bucket>bucket</Bucket>
                          <Key>go1.4.2</Key>
                          <UploadId>ntWSjzBytPT2xKLaMRonzXncsO10EH4Fc-Iq2-4hG-ulRYB</UploadId>
                          <Initiator>
                            <ID>minio</ID>
                            <DisplayName>minio</DisplayName>
                          </Initiator>
                          <Owner>
                            <ID>minio</ID>
                            <DisplayName>minio</DisplayName>
                          </Owner>
                          <StorageClass>STANDARD</StorageClass>
                          <PartNumberMarker>0</PartNumberMarker>
                          <NextPartNumberMarker>0</NextPartNumberMarker>
                          <MaxParts>1000</MaxParts>
                          <IsTruncated>false</IsTruncated>
                          <Part>
                            <PartNumber>3</PartNumber>
                            <ETag>79b281060d337b9b2b84ccf390adcf74</ETag>
                            <LastModified>2015-06-03T03:12:34.756Z</LastModified>
                            <Size>5242880</Size>
                          </Part>
                          <Part>
                            <PartNumber>4</PartNumber>
                            <ETag>79b281060d337b9b2b84ccf390adcf74</ETag>
                            <LastModified>2015-06-03T03:12:34.756Z</LastModified>
                            <Size>5242880</Size>
                          </Part>
                        </ListPartsResult>
                     '''
        mock_server = MockConnection()
        mock_connection.return_value = mock_server
        mock_server.mock_add_request(
            MockResponse('GET',
                         'https://localhost:9000/bucket/key?max-parts=1000&uploadId=upload_id',
                         {'User-Agent': _DEFAULT_USER_AGENT}, 200, content=mock_data1))


        client = Minio('localhost:9000')
        part_iter = client._list_object_parts('bucket', 'key', 'upload_id')

        parts = []
        for part in part_iter:
            mock_server.mock_add_request(
                MockResponse('GET',
                             'https://localhost:9000/bucket/key?max-parts=1000&part-number-marker=2&uploadId=upload_id',
                             {'User-Agent': _DEFAULT_USER_AGENT}, 200, content=mock_data2))
            parts.append(part)
        eq_(4, len(parts))
开发者ID:bacongobbler,项目名称:minio-py,代码行数:86,代码来源:list_uploaded_parts_test.py


注:本文中的minio.Minio._list_object_parts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。