コード例 #1
0
    def test_bool_valid(self):
        """
        If the bool is valid, it should return successfully.
        """
        config = get_basic_config(**{'setting_name': 'false'})

        # This should not raise an Exception
        configuration_utils.validate_non_required_bool(config, 'setting_name')
コード例 #2
0
    def test_bool_valid(self):
        """
        If the bool is valid, it should return successfully.
        """
        config = get_basic_config(**{'setting_name': 'false'})

        # This should not raise an Exception
        configuration_utils.validate_non_required_bool(config, 'setting_name')
コード例 #3
0
    def test_bool_not_set(self):
        """
        If the bool is not set, it should be cool.
        """
        config = get_basic_config()

        # This should not raise an Exception, since the setting is not required
        configuration_utils.validate_non_required_bool(config, 'setting_name')
コード例 #4
0
    def test_bool_not_set(self):
        """
        If the bool is not set, it should be cool.
        """
        config = get_basic_config()

        # This should not raise an Exception, since the setting is not required
        configuration_utils.validate_non_required_bool(config, 'setting_name')
コード例 #5
0
ファイル: configuration.py プロジェクト: ATIX-AG/pulp_rpm
def _validate_validate_downloads(config):
    """
    This (humorously named) method will validate the optional config option called
    "validate_downloads". If it is set, it must be a boolean, otherwise it may be None.

    :param config: the config to be validated
    :type  config: pulp.plugins.config.PluginCallConfiguration
    """
    configuration_utils.validate_non_required_bool(config, importer_constants.KEY_VALIDATE)
コード例 #6
0
ファイル: configuration.py プロジェクト: bechtoldt/pulp_rpm
def _validate_remove_missing_units(config):
    """
    This method will validate the optional config setting called "remove_missing_units". If it is set, it must
    be a boolean, otherwise it may be None.

    :param config: the config to be validated
    :type  config: pulp.plugins.config.PluginCallConfiguration
    """
    configuration_utils.validate_non_required_bool(config, importer_constants.KEY_UNITS_REMOVE_MISSING)
コード例 #7
0
def _validate_validate_downloads(config):
    """
    This (humorously named) method will validate the optional config option called
    "validate_downloads". If it is set, it must be a boolean, otherwise it may be None.

    :param config: the config to be validated
    :type  config: pulp.plugins.config.PluginCallConfiguration
    """
    configuration_utils.validate_non_required_bool(
        config, importer_constants.KEY_VALIDATE)
コード例 #8
0
def _validate_remove_missing_units(config):
    """
    This method will validate the optional config setting called "remove_missing_units". If it is
    set, it must
    be a boolean, otherwise it may be None.

    :param config: the config to be validated
    :type  config: pulp.plugins.config.PluginCallConfiguration
    """
    configuration_utils.validate_non_required_bool(
        config, importer_constants.KEY_UNITS_REMOVE_MISSING)
コード例 #9
0
    def test_bool_not_valid(self):
        """
        If the bool is not valid, it should return an error.
        """
        config = get_basic_config(**{'setting_name': 'Not true or false.'})

        try:
            configuration_utils.validate_non_required_bool(config, 'setting_name')
            self.fail('The validation should have failed, but it did not.')
        except configuration_utils.ValidationError, e:
            self.assertEqual(str(e), 'The configuration parameter <setting_name> may only be set to a '
                                     'boolean value, but is currently set to <Not true or false.>.')
コード例 #10
0
    def test_bool_not_valid(self):
        """
        If the bool is not valid, it should return an error.
        """
        config = get_basic_config(**{'setting_name': 'Not true or false.'})

        try:
            configuration_utils.validate_non_required_bool(
                config, 'setting_name')
            self.fail('The validation should have failed, but it did not.')
        except configuration_utils.ValidationError, e:
            self.assertEqual(
                str(e),
                'The configuration parameter <setting_name> may only be set to a '
                'boolean value, but is currently set to <Not true or false.>.')