Esempio n. 1
0
 def test_invoke_with_no_credentials(self):
     # This is what happens you have no credentials.
     # get_credentials() return None.
     self.session.get_credentials.return_value = None
     caller = CLIOperationCaller(self.session)
     with self.assertRaises(NoCredentialsError):
         caller.invoke(None, None, None)
Esempio n. 2
0
def display_response(session, operation_name, result, parsed_globals):
    if result is not None:
        cli_operation_caller = CLIOperationCaller(session)
        # Calling a private method. Should be changed after the functionality
        # is moved outside CliOperationCaller.
        cli_operation_caller._display_response(operation_name, result,
                                               parsed_globals)
Esempio n. 3
0
def display_response(session, operation_name, result, parsed_globals):
    if result is not None:
        cli_operation_caller = CLIOperationCaller(session)
        # Calling a private method. Should be changed after the functionality
        # is moved outside CliOperationCaller.
        cli_operation_caller._display_response(
            operation_name, result, parsed_globals)
Esempio n. 4
0
 def test_invoke_with_page_size(self):
     operation_object = mock.Mock()
     paginate = operation_object.paginate
     operation_object.can_paginate = True
     parsed_globals = mock.Mock()
     parsed_globals.paginate = True
     parsed_globals.page_size = '10'
     parameters = {}
     caller = CLIOperationCaller(self.session)
     with mock.patch('awscli.clidriver.CLIOperationCaller._display_response'):
         caller.invoke(operation_object, parameters, parsed_globals)
     self.assertEqual(paginate.call_args[1], {'page_size': u'10'})
Esempio n. 5
0
 def test_invoke_with_no_page_size(self):
     operation_object = mock.Mock()
     paginate = operation_object.paginate
     operation_object.can_paginate = True
     parsed_globals = mock.Mock()
     parsed_globals.paginate = True
     parsed_globals.page_size = None
     parameters = {}
     caller = CLIOperationCaller(self.session)
     with mock.patch('awscli.clidriver.CLIOperationCaller._display_response'):
         caller.invoke(operation_object, parameters, parsed_globals)
     # No parameters were passed to it (i.e. only self and endpoint).
     self.assertEqual(len(paginate.call_args), 2)
Esempio n. 6
0
 def test_invoke_with_page_size(self):
     operation_object = mock.Mock()
     paginate = operation_object.paginate
     operation_object.can_paginate = True
     parsed_globals = mock.Mock()
     parsed_globals.paginate = True
     parsed_globals.page_size = '10'
     parameters = {}
     caller = CLIOperationCaller(self.session)
     with mock.patch(
             'awscli.clidriver.CLIOperationCaller._display_response'):
         caller.invoke(operation_object, parameters, parsed_globals)
     self.assertEqual(paginate.call_args[1], {'page_size': u'10'})
Esempio n. 7
0
 def test_invoke_with_no_page_size(self):
     operation_object = mock.Mock()
     paginate = operation_object.paginate
     operation_object.can_paginate = True
     parsed_globals = mock.Mock()
     parsed_globals.paginate = True
     parsed_globals.page_size = None
     parameters = {}
     caller = CLIOperationCaller(self.session)
     with mock.patch(
             'awscli.clidriver.CLIOperationCaller._display_response'):
         caller.invoke(operation_object, parameters, parsed_globals)
     # No parameters were passed to it (i.e. only self and endpoint).
     self.assertEqual(len(paginate.call_args), 2)
Esempio n. 8
0
def _building_command_table(command_table, session, **kwargs):
    # Hooked up to building-command-table.rds
    # We don't need the modify-option-group operation.
    del command_table['modify-option-group']
    # We're going to replace modify-option-group with two commands:
    # add-option-group and remove-option-group
    rds_model = session.get_service_model('rds')
    modify_operation_model = rds_model.operation_model('ModifyOptionGroup')
    command_table['add-option-to-option-group'] = ServiceOperation(
        parent_name='rds', name='add-option-to-option-group',
        operation_caller=CLIOperationCaller(session),
        session=session,
        operation_model=modify_operation_model)
    command_table['remove-option-from-option-group'] = ServiceOperation(
        parent_name='rds', name='remove-option-from-option-group',
        session=session,
        operation_model=modify_operation_model,
        operation_caller=CLIOperationCaller(session))
Esempio n. 9
0
def call_and_display_response(session, operation_name, parameters,
                              parsed_globals):
    cli_operation_caller = CLIOperationCaller(session)
    cli_operation_caller.invoke(
        'emr', operation_name,
        parameters, parsed_globals)
Esempio n. 10
0
def call_and_display_response(session, operation_name, parameters,
                              parsed_globals):
        cli_operation_caller = CLIOperationCaller(session)
        cli_operation_caller.invoke(
            session.get_service('emr').get_operation(operation_name),
            parameters, parsed_globals)
Esempio n. 11
0
def call_and_display_response(session, operation_name, parameters, parsed_globals):
    cli_operation_caller = CLIOperationCaller(session)
    cli_operation_caller.invoke("emr", operation_name, parameters, parsed_globals)