Example #1
0
    def test_loadWithExistingFile(self):
        config_path = _get_config_file_path()

        if exists(config_path):
            os.remove(config_path)

        assert catcher.lastLogRecord is None
        load()
        assert catcher.lastLogRecord is not None
Example #2
0
    def test_setWithoutExistingFile(self):
        config_path = _get_config_file_path()

        if exists(config_path):
            os.remove(config_path)

        set("lang", "plop")
        value = get("lang")
        assert (type(value) is str or type(value)
                is unicode) and value == "plop"
Example #3
0
    def test_getAkeyNotPresentInFile(self):
        config_path = _get_config_file_path()

        # delete the file
        if exists(config_path):
            os.remove(config_path)

        # create the file
        set("proxy_port", 42)

        value = get("proxy_type")
        assert (type(value) is str or type(value)
                is unicode) and value == "HTTP"
Example #4
0
    def test_loadWithoutExistingFile(self):
        config_path = _get_config_file_path()

        if exists(config_path):
            os.remove(config_path)

        # create a config file
        set('lang', 'plop')

        assert catcher.lastLogRecord is None
        load()
        assert catcher.lastLogRecord is None

        assert get('lang') == 'plop'
Example #5
0
    def test_setWithExistingFile(self):
        config_path = _get_config_file_path()

        if exists(config_path):
            os.remove(config_path)

        # create the file
        set("lang", "plop")

        # overwrite the file
        set("autorun", True)

        value = get("lang")
        assert (type(value) is str or type(value)
                is unicode) and value == "plop"

        value = get("autorun")
        assert type(value) is bool and value
Example #6
0
def teardown_module(module):
    restoreConf(_get_config_file_path())
    removeBackup()

    logger = logging.getLogger()
    logger.removeHandler(catcher)
Example #7
0
def setup_module(module):
    backupConf(_get_config_file_path())
    _logger = logging.getLogger()
    _logger.addHandler(catcher)