Ejemplo n.º 1
0
class TestPaginatorDocumenter(BaseDocsTest):
    def setUp(self):
        super(TestPaginatorDocumenter, self).setUp()
        self.add_shape_to_params('Biz', 'String')
        self.extra_setup()

    def extra_setup(self):
        self.setup_client()
        paginator_model = PaginatorModel(self.paginator_json_model)
        self.paginator_documenter = PaginatorDocumenter(
            client=self.client, service_paginator_model=paginator_model)

    def test_document_paginators(self):
        self.paginator_documenter.document_paginators(
            self.doc_structure)
        self.assert_contains_lines_in_order([
            '==========',
            'Paginators',
            '==========',
            'The available paginators are:',
            '* :py:class:`MyService.Paginator.sample_operation`',
            '.. py:class:: MyService.Paginator.sample_operation',
            '  ::',
            '    paginator = client.get_paginator(\'sample_operation\')',
            '  .. py:method:: paginate(**kwargs)',
            ('    Creates an iterator that will paginate through responses'
             ' from :py:meth:`MyService.Client.sample_operation`.'),
            '    **Request Syntax**',
            '    ::',
            '      response_iterator = paginator.paginate(',
            '          Biz=\'string\',',
            '          PaginationConfig={',
            '              \'MaxItems\': 123,',
            '              \'PageSize\': 123,',
            '              \'StartingToken\': \'string\'',
            '          }',
            '      )',
            '    :type Biz: string',
            '    :param Biz:',
            '    :type PaginationConfig: dict',
            '    :param PaginationConfig:',
            ('      A dictionary that provides parameters to '
             'control pagination.'),
            '      - **MaxItems** *(integer) --*',
            '      - **PageSize** *(integer) --*',
            '      - **StartingToken** *(string) --*',
            '    :rtype: dict',
            '    :returns:',
            '      **Response Syntax**',
            '      ::',
            '        {',
            '            \'Biz\': \'string\',',
            '            \'NextToken\': \'string\'',
            '        }',
            '      **Response Structure**',
            '      - *(dict) --*',
            '        - **Biz** *(string) --*',
            '        - **NextToken** *(string) --*'
        ])
Ejemplo n.º 2
0
 def paginator_api(self, section):
     try:
         service_paginator_model = self._session.get_paginator_model(
             self._service_name)
     except DataNotFoundError:
         return
     paginator_documenter = PaginatorDocumenter(
         self._client, service_paginator_model)
     paginator_documenter.document_paginators(section)
Ejemplo n.º 3
0
 def _document_paginators(self, section):
     try:
         paginator_model = self._botocore_session.get_paginator_model(
             self._service_name)
     except DataNotFoundError:
         return
     paginator_documenter = PaginatorDocumenter(self._client,
                                                paginator_model)
     paginator_documenter.document_paginators(section)
 def extra_setup(self):
     self.setup_client()
     paginator_model = PaginatorModel(self.paginator_json_model)
     self.paginator_documenter = PaginatorDocumenter(
         client=self.client, service_paginator_model=paginator_model)
Ejemplo n.º 5
0
 def extra_setup(self):
     self.setup_client()
     paginator_model = PaginatorModel(self.paginator_json_model)
     self.paginator_documenter = PaginatorDocumenter(
         client=self.client, service_paginator_model=paginator_model)