def test_configparser_false_callback(self): def parser_callback(section, option, old_value, new_value): return False ccp = CallbackConfigParser() ccp.read_file(os.path.join(self.CONFIG_FILES_DIR, 'config1.conf')) ccp.set_callback(parser_callback) ccp.set('search_community', 'enabled', False)
def test_configparser_set_callback(self): def parser_callback(section, option, old_value, new_value): return True ccp = CallbackConfigParser() ccp.set_callback(parser_callback) ccp.read_file(os.path.join(self.CONFIG_FILES_DIR, 'config1.conf')) ccp.set('search_community', 'enabled', False) ccp.set('search_community', 'bar', 42) self.assertFalse(ccp.get('search_community', 'enabled')) self.assertEquals(ccp.get('search_community', 'bar'), 42)