当前位置: 首页>>代码示例>>Python>>正文


Python Conf.get_tracks_in_oc_dict方法代码示例

本文整理汇总了Python中galicaster.core.conf.Conf.get_tracks_in_oc_dict方法的典型用法代码示例。如果您正苦于以下问题:Python Conf.get_tracks_in_oc_dict方法的具体用法?Python Conf.get_tracks_in_oc_dict怎么用?Python Conf.get_tracks_in_oc_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在galicaster.core.conf.Conf的用法示例。


在下文中一共展示了Conf.get_tracks_in_oc_dict方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_hostname

# 需要导入模块: from galicaster.core.conf import Conf [as 别名]
# 或者: from galicaster.core.conf.Conf import get_tracks_in_oc_dict [as 别名]
 def test_get_hostname(self):
     conf = Conf()
     conf.set("config", "ingest", None)
     conf.set("basic", "admin", "True")
     conf.set("ingest", "hostname", None)
     self.assertEqual("GCMobile-" + socket.gethostname(), conf.get_hostname())
     self.assertEqual(1, len(conf.get_tracks_in_oc_dict()))
     self.assertEqual({"capture.device.names": "defaults"}, conf.get_tracks_in_oc_dict())
     conf.set("basic", "admin", "False")
     self.assertEqual("GC-" + socket.gethostname(), conf.get_hostname())
     name = "123456_654321"
     conf.set("ingest", "hostname", name)
     self.assertEqual(name, conf.get_hostname())
开发者ID:rubenrua,项目名称:Galicaster,代码行数:15,代码来源:conf.py

示例2: test_get_hostname

# 需要导入模块: from galicaster.core.conf import Conf [as 别名]
# 或者: from galicaster.core.conf.Conf import get_tracks_in_oc_dict [as 别名]
 def test_get_hostname(self):
     conf = Conf(self.conf_file)
     conf.set('config', 'ingest', None)
     conf.set('basic', 'admin', 'True')
     conf.set('ingest', 'hostname', None)
     self.assertEqual('GCMobile-' + socket.gethostname(), conf.get_hostname())
     self.assertEqual(1, len(conf.get_tracks_in_oc_dict()))
     self.assertEqual({'capture.device.names': 'defaults'}, conf.get_tracks_in_oc_dict())
     conf.set('basic', 'admin', 'False')
     conf.set('ingest', 'hostname', None)
     self.assertEqual('GC-' + socket.gethostname(), conf.get_hostname())
     name = "123456_654321"
     conf.set('ingest', 'hostname', name)
     self.assertEqual(name, conf.get_hostname())
     a = conf.remove_option('ingest', 'hostname')
开发者ID:SussexLearningSystems,项目名称:Galicaster,代码行数:17,代码来源:conf.py

示例3: TestFunctions

# 需要导入模块: from galicaster.core.conf import Conf [as 别名]
# 或者: from galicaster.core.conf.Conf import get_tracks_in_oc_dict [as 别名]
class TestFunctions(TestCase):
    def setUp(self):
        conf_file = get_resource("conf/conf.ini")
        dist_file = get_resource("conf/conf-dist.ini")
        self.conf = Conf(conf_file, dist_file)

    def tearDown(self):
        del self.conf

    def test_init_no_file(self):
        primary_conf = path.join("/etc/galicaster", "conf.ini")
        secondary_conf = path.abspath(path.join(path.dirname(__file__), "..", "..", "conf.ini"))
        secondary_dist = path.abspath(path.join(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 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_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")
        self.assertEqual("value", self.conf.get("section", "key"))

    def test_reload(self):
        self.conf.set("basic", "temp", "temporal")
        self.assertEqual("temporal", self.conf.get("basic", "temp"))
        self.conf.reload()
        self.assertEqual("/tmp/repo", self.conf.get("basic", "temp"))

    def test_get_tracks_in_oc_dict(self):
        conf = self.conf.get_tracks_in_oc_dict()
        self.assertEqual(len(conf), 3 * 3 + 1)
        self.assertEqual(conf["capture.device.names"], "track1,track3,track2")
        self.assertEqual(conf["capture.device.track2.outputfile"], "SCREEN.mpeg")
        self.assertEqual(conf["capture.device.track2.src"], "/dev/null")

    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)

    def test_init_track(self):
        track = Track()
        self.assertEqual(track.name, None)
        self.assertEqual(track.device, None)
        self.assertEqual(track.flavor, None)
        self.assertEqual(track.location, None)
        self.assertEqual(track.file, None)
        self.assertEqual(len(track), 5)

        track.name = "v_name"
        track.device = "v_device"
        track.flavor = "v_flavor"
        track.location = "v_location"
        track.file = "v_file"

        self.assertEqual(track.name, "v_name")
        self.assertEqual(track.device, "v_device")
        self.assertEqual(track.flavor, "v_flavor")
        self.assertEqual(track.location, "v_location")
        self.assertEqual(track.file, "v_file")
        self.assertEqual(track["name"], "v_name")
        self.assertEqual(track["device"], "v_device")
        self.assertEqual(track["flavor"], "v_flavor")
        self.assertEqual(track["location"], "v_location")
        self.assertEqual(track["file"], "v_file")

        self.assertEqual(track.keys(), ["name", "device", "flavor", "location", "file"])
        self.assertEqual(track.values(), ["v_name", "v_device", "v_flavor", "v_location", "v_file"])
        self.assertEqual(
            track.basic(),
            {"name": "v_name", "device": "v_device", "flavor": "v_flavor", "location": "v_location", "file": "v_file"},
        )
        self.assertEqual(track.options(), {})

    def test_add_and_del_value_in_track(self):
        track = Track()
        track["new_key"] = "new_value"
        self.assertEqual(len(track), 6)
        self.assertEqual(track["new_key"], "new_value")
        self.assertEqual(track.keys(), ["name", "device", "flavor", "location", "file", "new_key"])
        self.assertEqual(track.values(), [None, None, None, None, None, "new_value"])
        self.assertEqual(track.basic(), {"name": None, "device": None, "flavor": None, "location": None, "file": None})
        self.assertEqual(track.options(), {"new_key": "new_value"})

        del track["new_key"]
#.........这里部分代码省略.........
开发者ID:rubenrua,项目名称:Galicaster,代码行数:103,代码来源:conf.py

示例4: TestFunctions

# 需要导入模块: from galicaster.core.conf import Conf [as 别名]
# 或者: from galicaster.core.conf.Conf import get_tracks_in_oc_dict [as 别名]

#.........这里部分代码省略.........
        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')
        self.assertEqual('value', self.conf.get('section', 'key'))


    def test_get_all(self):
        full = self.conf.get_all()
        user_conf = self.conf.get_all(False)
        self.assertTrue(len(full) > len(user_conf))


    def test_reload(self):
        self.conf.set('basic', 'temp', 'temporary')
        self.assertEqual('temporary', self.conf.get('basic', 'temp'))
        self.conf.set('basic', 'temp', 'newtemporary')
        self.assertEqual('newtemporary', self.conf.get('basic', 'temp'))
        self.conf.remove_option('basic', 'temp')
        self.assertEqual(None, self.conf.get('basic', 'temp'))
        self.conf.reload()
        self.assertEqual('newtemporary', self.conf.get('basic', 'temp'))


    def test_get_tracks_in_oc_dict(self):
        conf = self.conf.get_tracks_in_oc_dict()
        self.assertEqual(len(conf), 3*3 +1)
        self.assertEqual(conf['capture.device.names'], 'track1,track3,track2')
        self.assertEqual(conf['capture.device.track2.outputfile'], 'SCREEN.mpeg')
        self.assertEqual(conf['capture.device.track2.src'], '/dev/null')


    def test_init_track(self):
        track = Track()
        self.assertEqual(track.name, '')
        self.assertEqual(track.device, '')
        self.assertEqual(track.flavor, '')
        self.assertEqual(track.location, '')
        self.assertEqual(track.file, '')
        self.assertEqual(len(track), 5)

        track.name = 'v_name'
        track.device = 'v_device'
        track.flavor = 'v_flavor'
        track.location = 'v_location'
        track.file = 'v_file'

        self.assertEqual(track.name, 'v_name')
        self.assertEqual(track.device, 'v_device')
        self.assertEqual(track.flavor, 'v_flavor')
        self.assertEqual(track.location, 'v_location')
        self.assertEqual(track.file, 'v_file')
        self.assertEqual(track['name'], 'v_name')
        self.assertEqual(track['device'], 'v_device')
        self.assertEqual(track['flavor'], 'v_flavor')
        self.assertEqual(track['location'], 'v_location')
        self.assertEqual(track['file'], 'v_file')
开发者ID:SussexLearningSystems,项目名称:Galicaster,代码行数:70,代码来源:conf.py


注:本文中的galicaster.core.conf.Conf.get_tracks_in_oc_dict方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。