Exemplo n.º 1
0
 def test_description_only_for_crosslink_manpage(self):
     help_command = self.create_help_command()
     operation_handler = OperationDocumentEventHandler(help_command)
     operation_handler.doc_description(help_command=help_command)
     rendered = help_command.doc.getvalue().decode('utf-8')
     # The links are generated in the "man" mode.
     self.assertIn('See also: AWS API Documentation', rendered)
Exemplo n.º 2
0
 def test_includes_global_args_ref_in_man_options(self):
     help_command = self.create_help_command()
     operation_handler = OperationDocumentEventHandler(help_command)
     operation_handler.doc_options_end(help_command=help_command)
     rendered = help_command.doc.getvalue().decode('utf-8')
     # The links aren't generated in the "man" mode.
     self.assertIn("See 'aws help' for descriptions of global parameters",
                   rendered)
Exemplo n.º 3
0
 def setUp(self):
     self.arg_table = {}
     self.help_command = mock.Mock()
     self.help_command.event_class = 'custom'
     self.help_command.arg_table = self.arg_table
     self.help_command.obj.service.operations = []
     self.operation_handler = OperationDocumentEventHandler(
         self.help_command)
Exemplo n.º 4
0
 def test_includes_global_args_ref_in_html_options(self):
     help_command = self.create_help_command()
     help_command.doc.target = 'html'
     operation_handler = OperationDocumentEventHandler(help_command)
     operation_handler.doc_options_end(help_command=help_command)
     rendered = help_command.doc.getvalue().decode('utf-8')
     self.assertIn(
         "See :doc:`'aws help' </reference/index>` for descriptions of "
         "global parameters", rendered)
Exemplo n.º 5
0
 def get_help_docs_for_argument(self, shape):
     arg_table = {'arg-name': mock.Mock(argument_model=shape)}
     help_command = mock.Mock()
     help_command.doc = ReSTDocument()
     help_command.event_class = 'custom'
     help_command.arg_table = arg_table
     operation_model = mock.Mock()
     operation_model.service_model.operation_names = []
     help_command.obj = operation_model
     operation_handler = OperationDocumentEventHandler(help_command)
     operation_handler.doc_option('arg-name', help_command)
     return help_command.doc.getvalue().decode('utf-8')
Exemplo n.º 6
0
    def test_includes_webapi_crosslink_in_html(self):
        help_command = self.create_help_command()
        # Configure this for 'html' generation:
        help_command.obj.service_model.metadata = {'uid': 'service-1-2-3'}
        help_command.obj.name = 'myoperation'
        help_command.doc.target = 'html'

        operation_handler = OperationDocumentEventHandler(help_command)
        operation_handler.doc_description(help_command=help_command)
        rendered = help_command.doc.getvalue().decode('utf-8')
        # Should expect an externa link because we're generating html.
        self.assertIn(
            'See also: `AWS API Documentation '
            '<https://docs.aws.amazon.com/goto/'
            'WebAPI/service-1-2-3/myoperation>`_', rendered)
Exemplo n.º 7
0
 def test_documents_enum_values(self):
     shape = {'type': 'string', 'enum': ['FOO', 'BAZ']}
     shape = StringShape('EnumArg', shape)
     arg_table = {'arg-name': mock.Mock(argument_model=shape)}
     help_command = mock.Mock()
     help_command.doc = ReSTDocument()
     help_command.event_class = 'custom'
     help_command.arg_table = arg_table
     operation_model = mock.Mock()
     operation_model.service_model.operation_names = []
     help_command.obj = operation_model
     operation_handler = OperationDocumentEventHandler(help_command)
     operation_handler.doc_option('arg-name', help_command)
     rendered = help_command.doc.getvalue().decode('utf-8')
     self.assertIn('Possible values', rendered)
     self.assertIn('FOO', rendered)
     self.assertIn('BAZ', rendered)
Exemplo n.º 8
0
 def test_documents_json_header_shape(self):
     shape = {
         'type': 'string',
         'jsonvalue': True,
         'location': 'header',
         'locationName': 'X-Amz-Header-Name'
     }
     shape = StringShape('JSONValueArg', shape)
     arg_table = {'arg-name': mock.Mock(argument_model=shape)}
     help_command = mock.Mock()
     help_command.doc = ReSTDocument()
     help_command.event_class = 'custom'
     help_command.arg_table = arg_table
     operation_model = mock.Mock()
     operation_model.service_model.operation_names = []
     help_command.obj = operation_model
     operation_handler = OperationDocumentEventHandler(help_command)
     operation_handler.doc_option('arg-name', help_command)
     rendered = help_command.doc.getvalue().decode('utf-8')
     self.assertIn('(JSON)', rendered)