本文整理汇总了Python中galicaster.core.conf.Conf.get_profiles方法的典型用法代码示例。如果您正苦于以下问题:Python Conf.get_profiles方法的具体用法?Python Conf.get_profiles怎么用?Python Conf.get_profiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类galicaster.core.conf.Conf
的用法示例。
在下文中一共展示了Conf.get_profiles方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_profile_with_no_profiles_in_files
# 需要导入模块: from galicaster.core.conf import Conf [as 别名]
# 或者: from galicaster.core.conf.Conf import get_profiles [as 别名]
def test_profile_with_no_profiles_in_files(self):
conf_file = path.join(path.dirname(path.abspath(__file__)), 'resources', 'conf', 'conf.ini')
conf_dist_file = path.join(path.dirname(path.abspath(__file__)), 'resources', 'conf', 'conf_dist.ini')
profiles_dir = path.join(path.dirname(path.abspath(__file__)), 'resources', 'conf', 'profiles')
conf = Conf(conf_file, conf_dist_file, profiles_dir)
self.assertEqual(len(conf.get_profiles()), 1)
示例2: test_profile_with_no_profiles_in_files
# 需要导入模块: from galicaster.core.conf import Conf [as 别名]
# 或者: from galicaster.core.conf.Conf import get_profiles [as 别名]
def test_profile_with_no_profiles_in_files(self):
conf_file = get_resource('conf/conf.ini')
conf_dist_file = get_resource('conf/conf_dist.ini')
profiles_dir = get_resource('conf/profiles')
conf = Conf(conf_file, conf_dist_file, profiles_dir)
self.assertEqual(len(conf.get_profiles()), 1)
示例3: TestFunctions
# 需要导入模块: from galicaster.core.conf import Conf [as 别名]
# 或者: from galicaster.core.conf.Conf import get_profiles [as 别名]
class TestFunctions(TestCase):
def setUp(self):
conf_file = get_resource('profile/conf_good.ini')
conf_dist_file = get_resource('profile/conf-dist.ini')
folder_path = get_resource('profile/folder')
self.conf = Conf(conf_file,conf_dist_file, folder_path)
def no_test_create_profile(self):
profile=Profile("New profile")
self.assertEqual(profile.name, "New profile")
def no_test_create_and_add_profile(self):
self.setUp()
profile=Profile("New")
self.conf.add_profile(profile)
self.assertEqual(self.conf.get_profiles().has_key("New"),True)
def no_test_write_profile(self):
self.setUp()
folder_path = path.join(path.dirname(path.abspath(__file__)),
'resources', 'profile', 'folder')
profile=Profile("New profile", path.join(folder_path,"profile11.ini"))
self.conf.add_profile(profile)
self.conf.update_profiles()
path.isfile(path.join(folder_path,"profile11.ini"))
os.remove(path.join(folder_path,"profile11.ini"))
def no_test_write_profile_default_naming(self):
self.setUp()
folder_path = path.join(path.dirname(path.abspath(__file__)),
'resources', 'profile', 'folder')
profile=Profile("New profile")
profile.path=self.conf.get_free_profile()
self.conf.add_profile(profile)
self.conf.update_profiles()
path.isfile(path.join(folder_path,"profile1.ini"))
os.remove(path.join(folder_path,"profile1.ini"))
def no_test_delete_profile(self):
self.setUp()
folder_path = path.join(path.dirname(path.abspath(__file__)),
'resources', 'profile', 'folder')
profile=Profile("New")
profile.path=self.conf.get_free_profile()
self.conf.add_profile(profile)
self.conf.update_profiles()
profile.to_delete = True
self.conf.update_profiles()
self.assertEqual(path.isfile(path.join(folder_path,"profile1.ini")),False)
#os.remove(path.join(folder_path,"profile1.ini"))
return True
def change_parameters():
return True
def change_properties():
return True
def load_default_profile(self):
return True
def load_default_profile_on_dist(self):
return True
def see_all_tracks_in_conf(self):
return True
def look_for_an_unexisting_profile(self):
return True
def loof_for_an_existing_profile(self):
return True
def change_current_profile(self):
return True
def delete_current_profile(self):
return True
def set_default_to_current(self):
return True
def add_track():
return True
def delete_track():
return True
def get_video_areas_on_profile():
return True
def get_videos_areas_in_order():
return True
#.........这里部分代码省略.........
示例4: TestFunctions
# 需要导入模块: from galicaster.core.conf import Conf [as 别名]
# 或者: from galicaster.core.conf.Conf import get_profiles [as 别名]
class TestFunctions(TestCase):
def setUp(self):
self.conf_file = get_resource('conf/conf.ini')
self.backup_conf_file =get_resource('conf/conf.backup.ini')
dist_file = get_resource('conf/conf-dist.ini')
shutil.copyfile(self.conf_file,self.backup_conf_file)
self.conf = Conf(self.conf_file,dist_file)
self.conf.reload()
def tearDown(self):
shutil.copyfile(self.backup_conf_file,self.conf_file)
os.remove(self.backup_conf_file)
del self.conf
def touch(self, fname, times=None):
with open(fname, 'a'):
os.utime(fname, times)
def test_init_no_file(self):
primary_conf = os.path.join('/etc/galicaster','conf.ini')
secondary_conf = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'conf.ini'))
secondary_dist = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'conf-dist.ini'))
# Conf loads default conf and conf-dist
conf = Conf(conf_dist_file=secondary_dist)
self.assertEqual( primary_conf if os.path.isfile(primary_conf) else secondary_conf,
conf.conf_file)
self.assertEqual( secondary_dist,
conf.conf_dist_file)
def test_init_all_files(self):
conf_file = get_resource('conf/conf.ini')
conf_dist_file = get_resource('conf/conf-dist.ini')
conf = Conf(conf_file, conf_dist_file)
self.assertEqual(conf_file, conf.conf_file)
self.assertEqual(conf_dist_file, conf.conf_dist_file)
def test_invalid_ini(self):
conf_file = get_resource('conf/conf.ini')
conf_dist_file = get_resource('conf/conf_dist.ini')
profiles_dir = get_resource('conf/profiles')
conf = Conf(conf_file, conf_dist_file, profiles_dir)
conf.reload()
old_conf = self.conf.get_all()
content = ''
with open(get_resource('conf/conf.ini'), 'r') as content_file:
content = content_file.read()
# Override conf file
f = open(get_resource('conf/conf.ini'),'w')
f.write('testing wrong config file')
f.close()
conf_dist_file = get_resource('conf/conf_dist.ini')
profiles_dir = get_resource('conf/profiles')
conf = Conf(conf_file, conf_dist_file, profiles_dir)
conf.reload()
new_conf = self.conf.get_all()
self.assertEqual(old_conf, new_conf)
# Override conf file
f = open(get_resource('conf/conf.ini'),'w')
f.write(content)
f.close()
def test_active_tag_default_profile(self):
conf_file = get_resource('conf/conf_active.ini')
backup_conf_active = get_resource('conf/conf_active.backup.ini')
dist_file = get_resource('conf/conf-dist.ini')
shutil.copyfile(conf_file, backup_conf_active)
conf = Conf(conf_file, dist_file)
conf.reload()
profile = conf.get_current_profile()
self.assertEqual(1, len(profile.tracks))
shutil.copyfile(backup_conf_active, conf_file)
os.remove(backup_conf_active)
def test_profile_with_no_profiles_in_files(self):
conf_file = get_resource('conf/conf.ini')
conf_dist_file = get_resource('conf/conf_dist.ini')
profiles_dir = get_resource('conf/profiles')
conf = Conf(conf_file, conf_dist_file, profiles_dir)
conf.reload()
self.assertEqual(len(conf.get_profiles()), 1)
def test_get_and_set(self):
# GET data in conf-dist
self.assertEqual('full', self.conf.get('ingest', 'workflow'))
# GET data in conf
self.assertEqual('track1', self.conf.get('track1', 'name'))
# SET
self.conf.set('section', 'key', 'value')
#.........这里部分代码省略.........