本文整理汇总了Python中ambari_agent.HostInfo.HostInfo.etcAlternativesConf方法的典型用法代码示例。如果您正苦于以下问题:Python HostInfo.etcAlternativesConf方法的具体用法?Python HostInfo.etcAlternativesConf怎么用?Python HostInfo.etcAlternativesConf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ambari_agent.HostInfo.HostInfo
的用法示例。
在下文中一共展示了HostInfo.etcAlternativesConf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_etcAlternativesConf
# 需要导入模块: from ambari_agent.HostInfo import HostInfo [as 别名]
# 或者: from ambari_agent.HostInfo.HostInfo import etcAlternativesConf [as 别名]
def test_etcAlternativesConf(self, os_path_realpath_mock, os_path_islink_mock, os_listdir_mock, os_path_exists_mock):
hostInfo = HostInfo()
os_path_exists_mock.return_value = False
result = hostInfo.etcAlternativesConf('',[])
self.assertEquals(result, [])
os_path_exists_mock.return_value = True
os_listdir_mock.return_value = ['config1']
os_path_islink_mock.return_value = True
os_path_realpath_mock.return_value = 'real_path_to_conf'
result = []
hostInfo.etcAlternativesConf('project',result)
self.assertEquals(result[0]['name'], 'config1')
self.assertEquals(result[0]['target'], 'real_path_to_conf')
示例2: test_etcAlternativesConf
# 需要导入模块: from ambari_agent.HostInfo import HostInfo [as 别名]
# 或者: from ambari_agent.HostInfo.HostInfo import etcAlternativesConf [as 别名]
def test_etcAlternativesConf(
self, os_path_realpath_mock, os_path_islink_mock, os_listdir_mock, os_path_exists_mock
):
hostInfo = HostInfo()
os_path_exists_mock.return_value = False
result = hostInfo.etcAlternativesConf("", [])
self.assertEquals(result, [])
os_path_exists_mock.return_value = True
os_listdir_mock.return_value = ["config1"]
os_path_islink_mock.return_value = True
os_path_realpath_mock.return_value = "real_path_to_conf"
result = []
hostInfo.etcAlternativesConf("project", result)
self.assertEquals(result[0]["name"], "config1")
self.assertEquals(result[0]["target"], "real_path_to_conf")