Exemplo n.º 1
0
    def test_delete_unexpected_client_error(self):
        _test_name = 'test_delete'
        _ctx = self.get_mock_ctx(
            _test_name,
            test_properties=NODE_PROPERTIES,
            test_runtime_properties=RUNTIME_PROPERTIES_AFTER_CREATE,
            type_hierarchy=OPTION_GROUP_TH
        )
        current_ctx.set(_ctx)

        self.fake_client.delete_option_group = self._gen_client_error(
            'test_delete', message='SomeMessage', code='InvalidFault'
        )

        with self.assertRaises(ClientError) as error:
            option_group.delete(
                ctx=_ctx, resource_config=None, iface=None
            )

        self.assertEqual(
            str(error.exception), (
                'An error occurred (InvalidFault) when calling the ' +
                'client_error_test_delete operation: SomeMessage'
            )
        )
Exemplo n.º 2
0
    def test_delete(self):
        _test_name = 'test_delete'
        _ctx = self.get_mock_ctx(
            _test_name,
            test_properties=NODE_PROPERTIES,
            test_runtime_properties=RUNTIME_PROPERTIES_AFTER_CREATE,
            type_hierarchy=OPTION_GROUP_TH
        )
        current_ctx.set(_ctx)

        self.fake_client.delete_option_group = MagicMock(
            return_value={}
        )
        option_group.delete(
            ctx=_ctx, resource_config=None, iface=None
        )
        self.fake_boto.assert_called_with(
            'rds', **CLIENT_CONFIG
        )
        self.fake_client.delete_option_group.assert_called_with(
            OptionGroupName='dev-db-option-group'
        )

        self.assertEqual(
            _ctx.instance.runtime_properties, {
                '__deleted': True,
            }
        )
Exemplo n.º 3
0
    def test_immortal_delete(self):
        _test_name = 'test_delete'
        _ctx = self.get_mock_ctx(
            _test_name,
            test_properties=NODE_PROPERTIES,
            test_runtime_properties=RUNTIME_PROPERTIES_AFTER_CREATE,
            type_hierarchy=OPTION_GROUP_TH
        )
        current_ctx.set(_ctx)

        self.fake_client.delete_option_group = MagicMock(
            return_value={}
        )

        self.fake_client.describe_option_groups = MagicMock(
            return_value={
                'OptionGroupsList': [{
                    'OptionGroupName': 'dev-db-option-group',
                    'OptionGroupArn': 'OptionGroupArn'
                }]
            }
        )
        with self.assertRaises(OperationRetry) as error:
            option_group.delete(
                ctx=_ctx, resource_config=None, iface=None
            )

        self.assertEqual(
            str(error.exception),
            (
                'RDS Option Group ID# "dev-db-option-group" is still ' +
                'in a pending state.'
            )
        )
    def test_delete_unexpected_client_error(self):
        _test_name = 'test_delete'
        _ctx = self.get_mock_ctx(
            _test_name,
            test_properties=NODE_PROPERTIES,
            test_runtime_properties=RUNTIME_PROPERTIES_AFTER_CREATE,
            type_hierarchy=OPTION_GROUP_TH
        )
        current_ctx.set(_ctx)

        self.fake_client.delete_option_group = self._gen_client_error(
            'test_delete', message='SomeMessage', code='InvalidFault'
        )

        with self.assertRaises(ClientError) as error:
            option_group.delete(
                ctx=_ctx, resource_config=None, iface=None
            )

        self.assertEqual(
            str(error.exception), (
                'An error occurred (InvalidFault) when calling the ' +
                'client_error_test_delete operation: SomeMessage'
            )
        )
    def test_immortal_delete(self):
        _test_name = 'test_delete'
        _ctx = self.get_mock_ctx(
            _test_name,
            test_properties=NODE_PROPERTIES,
            test_runtime_properties=RUNTIME_PROPERTIES_AFTER_CREATE,
            type_hierarchy=OPTION_GROUP_TH
        )
        current_ctx.set(_ctx)

        self.fake_client.delete_option_group = MagicMock(
            return_value={}
        )

        self.fake_client.describe_option_groups = MagicMock(
            return_value={
                'OptionGroupsList': [{
                    'OptionGroupName': 'dev-db-option-group',
                    'OptionGroupArn': 'OptionGroupArn'
                }]
            }
        )
        with self.assertRaises(OperationRetry) as error:
            option_group.delete(
                ctx=_ctx, resource_config=None, iface=None
            )

        self.assertEqual(
            str(error.exception),
            (
                'RDS Option Group ID# "dev-db-option-group" is still ' +
                'in a pending state.'
            )
        )
    def test_delete(self):
        _test_name = 'test_delete'
        _ctx = self.get_mock_ctx(
            _test_name,
            test_properties=NODE_PROPERTIES,
            test_runtime_properties=RUNTIME_PROPERTIES_AFTER_CREATE,
            type_hierarchy=OPTION_GROUP_TH
        )
        current_ctx.set(_ctx)

        self.fake_client.delete_option_group = MagicMock(
            return_value={}
        )
        option_group.delete(
            ctx=_ctx, resource_config=None, iface=None
        )
        self.fake_boto.assert_called_with(
            'rds', **CLIENT_CONFIG
        )
        self.fake_client.delete_option_group.assert_called_with(
            OptionGroupName='dev-db-option-group'
        )

        self.assertEqual(
            _ctx.instance.runtime_properties, {
                '__deleted': True,
            }
        )
Exemplo n.º 7
0
    def test_delete_client_error(self):
        _test_name = 'test_delete'
        _ctx = self.get_mock_ctx(
            _test_name,
            test_properties=NODE_PROPERTIES,
            test_runtime_properties=RUNTIME_PROPERTIES_AFTER_CREATE,
            type_hierarchy=OPTION_GROUP_TH)
        current_ctx.set(_ctx)

        self.fake_client.delete_option_group = self._gen_client_error(
            'test_delete', message='SomeMessage')

        with self.assertRaises(OperationRetry) as error:
            option_group.delete(ctx=_ctx, resource_config=None, iface=None)

        self.assertEqual(text_type(error.exception), 'SomeMessage')
    def test_delete_client_error(self):
        _test_name = 'test_delete'
        _ctx = self.get_mock_ctx(
            _test_name,
            test_properties=NODE_PROPERTIES,
            test_runtime_properties=RUNTIME_PROPERTIES_AFTER_CREATE,
            type_hierarchy=OPTION_GROUP_TH
        )
        current_ctx.set(_ctx)

        self.fake_client.delete_option_group = self._gen_client_error(
            'test_delete', message='SomeMessage'
        )

        with self.assertRaises(OperationRetry) as error:
            option_group.delete(
                ctx=_ctx, resource_config=None, iface=None
            )

        self.assertEqual(
            str(error.exception), 'SomeMessage'
        )