Exemple #1
0
 def _create_operation_command(self, name, command):
     argument_table = self.create_argument_table(
         command.get('arguments', []))
     mock_operation = mock.Mock(spec=OperationModel)
     mock_operation.deprecated = False
     operation = ServiceOperation(name, 'parent', None, mock_operation,
                                  None)
     operation._arg_table = argument_table
     return operation
Exemple #2
0
 def setUp(self):
     self.name = 'list-objects'
     self.session = FakeSession()
     operation = self.session.get_service_model('s3').operation_model(
         'ListObjects')
     self.mock_operation = operation
     self.cmd = ServiceOperation(self.name, None, None, operation,
                                 self.session)
Exemple #3
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))
Exemple #4
0
 def test_idempotency_token_is_not_required(self):
     session = FakeSession()
     name = 'IdempotentOperation'
     service_model = session.get_service_model('s3')
     operation_model = service_model.operation_model(name)
     cmd = ServiceOperation(name, None, None, operation_model, session)
     arg_table = cmd.arg_table
     token_argument = arg_table.get('token')
     self.assertFalse(token_argument.required,
                      'Idempotency tokens should not be required')
Exemple #5
0
 def setUp(self):
     self.name = 'foo'
     self.cmd = ServiceOperation(self.name, None, None, None, None)
Exemple #6
0
 def test_deprecated_operation(self):
     self.mock_operation.deprecated = True
     cmd = ServiceOperation(self.name, None, None, self.mock_operation,
                            None)
     self.assertTrue(getattr(cmd, '_UNDOCUMENTED'))
Exemple #7
0
 def setUp(self):
     self.name = 'foo'
     operation = mock.Mock(spec=botocore.model.OperationModel)
     operation.deprecated = False
     self.mock_operation = operation
     self.cmd = ServiceOperation(self.name, None, None, operation, None)
 def _create_operation_command(self, name, command):
     argument_table = self.create_argument_table(
         command.get('arguments', []))
     operation = ServiceOperation(name, 'parent', None, {}, None)
     operation._arg_table = argument_table
     return operation