本文整理汇总了Python中gns3server.modules.project.Project.list_files方法的典型用法代码示例。如果您正苦于以下问题:Python Project.list_files方法的具体用法?Python Project.list_files怎么用?Python Project.list_files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gns3server.modules.project.Project
的用法示例。
在下文中一共展示了Project.list_files方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_list_files
# 需要导入模块: from gns3server.modules.project import Project [as 别名]
# 或者: from gns3server.modules.project.Project import list_files [as 别名]
def test_list_files(tmpdir, loop):
with patch("gns3server.config.Config.get_section_config", return_value={"project_directory": str(tmpdir)}):
project = Project()
path = project.path
os.makedirs(os.path.join(path, "vm-1", "dynamips"))
with open(os.path.join(path, "vm-1", "dynamips", "test.bin"), "w+") as f:
f.write("test")
open(os.path.join(path, "vm-1", "dynamips", "test.ghost"), "w+").close()
with open(os.path.join(path, "test.txt"), "w+") as f:
f.write("test2")
files = loop.run_until_complete(asyncio.async(project.list_files()))
assert files == [
{
"path": "test.txt",
"md5sum": "ad0234829205b9033196ba818f7a872b"
},
{
"path": os.path.join("vm-1", "dynamips", "test.bin"),
"md5sum": "098f6bcd4621d373cade4e832627b4f6"
}
]