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