本文整理汇总了Python中galicaster.core.conf.Conf.get_ip_address方法的典型用法代码示例。如果您正苦于以下问题:Python Conf.get_ip_address方法的具体用法?Python Conf.get_ip_address怎么用?Python Conf.get_ip_address使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类galicaster.core.conf.Conf
的用法示例。
在下文中一共展示了Conf.get_ip_address方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestFunctions
# 需要导入模块: from galicaster.core.conf import Conf [as 别名]
# 或者: from galicaster.core.conf.Conf import get_ip_address [as 别名]
#.........这里部分代码省略.........
def test_get_json(self):
self.assertEqual(self.conf.get_json('s', 'k'), {})
self.conf.set('s', 'k', '{"a":{"a1":"value1", "a2":"value2"},"b": "value3"}')
self.assertEqual(self.conf.get_json('s', 'k'), {"a": {"a1": "value1", "a2": "value2"}, "b": "value3"})
def test_track_property(self):
track = Track()
track.name = 'name'
self.assertEqual(track.name, 'name')
self.assertEqual(track['name'], 'name')
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')
def test_get_ip_address(self):
valid = True
try:
addr = self.conf.get_ip_address()
socket.inet_aton(addr)
except socket.error:
valid = False
self.assertTrue(valid)
def test_set_section(self):
self.assertEqual(self.conf.set_section(None, {}), False)
self.assertEqual(self.conf.set_section('k', {"a": "1", "b" :"2"}), True)
def test_get_section(self):
self.assertEqual(self.conf.set_section('k', {"a": "1", "b" :"2"}), True)
self.assertEqual(self.conf.get_section('k'), {"a": "1", "b" :"2"})
self.assertEqual(self.conf.get_section('kkkkkk'), {})
def test_get_user_section(self):
self.assertEqual(self.conf.set_section('k', {"a": "1", "b" :"2"}), True)
self.assertEqual(self.conf.get_user_section('k'), {"a": "1", "b" :"2"})
self.assertEqual(self.conf.get_user_section('kkkkkk'), {})
def test_get_sections(self):
self.conf.remove_sections()
self.assertEqual(self.conf.get_sections(), ['basic'])
self.assertEqual(self.conf.get_user_sections(), [])
def test_get_modules(self):
self.assertEqual(self.conf.get_modules(), ['recorder', 'scheduler'])
self.conf.set('basic', 'admin', 'True')