def test_translate_deprecated_setting_without_old_setting(old, new):
    # Before: deprecated setting will *NOT* be in settings object.
    #         new setting will be in settings object and have its value
    #
    # After:  deprecated setting will still *NOT* be in settings object
    #         new setting will still have its value (remain unchanged)

    settings = apply_server_side_settings()
    apply_config_setting(settings, new.name, new.value)

    assert old.name not in flatten_settings(settings)
    assert fetch_config_setting(settings, new.name) == new.value

    cached = [(new.name, new.value)]
    result = translate_deprecated_settings(settings, cached)

    assert result is settings
    assert old.name not in flatten_settings(result)
    assert fetch_config_setting(result, new.name) == new.value
示例#2
0
    def do_dump_config(self, name=None):
        """
        Displays global configuration or that of the named application.
        """

        if name is None:
            config = agent_instance().global_settings()
        else:
            config = agent_instance().application_settings(name)

        if config is not None:
            config = flatten_settings(config)
            keys = sorted(config.keys())
            for key in keys:
                print('%s = %r' % (key, config[key]), file=self.stdout)
示例#3
0
    def do_dump_config(self, name=None):
        """
        Displays global configuration or that of the named application.
        """

        if name is None:
            config = agent_instance().global_settings()
        else:
            config = agent_instance().application_settings(name)

        if config is not None:
            config = flatten_settings(config)
            keys = sorted(config.keys())
            for key in keys:
                print >> self.stdout, '%s = %r' % (key, config[key])
def test_translate_deprecated_setting_without_new_setting(old, new):
    # Before: deprecated setting will be in settings object.
    #         new setting will be in settings object and have default value
    #
    # After:  deprecated setting will *NOT* be in settings object
    #         new setting will have value of deprecated setting

    settings = apply_server_side_settings()
    apply_config_setting(settings, old.name, old.value)

    assert fetch_config_setting(settings, old.name) == old.value
    assert fetch_config_setting(settings, new.name) == new.default

    cached = [(old.name, old.value)]
    result = translate_deprecated_settings(settings, cached)

    assert result is settings
    assert old.name not in flatten_settings(result)
    assert fetch_config_setting(result, new.name) == old.value