Beispiel #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
Beispiel #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)
Beispiel #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))
Beispiel #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')
Beispiel #5
0
 def setUp(self):
     self.name = 'foo'
     self.cmd = ServiceOperation(self.name, None, None, None, None)
Beispiel #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'))
Beispiel #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)
Beispiel #8
0
 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