示例#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
示例#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"
示例#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"
示例#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'
示例#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
示例#6
0
def teardown_module(module):
    restoreConf(_get_config_file_path())
    removeBackup()

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