本文整理汇总了Python中gns3server.modules.project.Project.commit方法的典型用法代码示例。如果您正苦于以下问题:Python Project.commit方法的具体用法?Python Project.commit怎么用?Python Project.commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gns3server.modules.project.Project
的用法示例。
在下文中一共展示了Project.commit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_commit
# 需要导入模块: from gns3server.modules.project import Project [as 别名]
# 或者: from gns3server.modules.project.Project import commit [as 别名]
def test_commit(manager, loop):
project = Project()
vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager)
project.add_vm(vm)
directory = project.vm_working_directory(vm)
project.mark_vm_for_destruction(vm)
assert len(project._vms_to_destroy) == 1
assert os.path.exists(directory)
loop.run_until_complete(asyncio.async(project.commit()))
assert len(project._vms_to_destroy) == 0
assert os.path.exists(directory) is False
assert len(project.vms) == 0
示例2: test_commit_permission_issue
# 需要导入模块: from gns3server.modules.project import Project [as 别名]
# 或者: from gns3server.modules.project.Project import commit [as 别名]
def test_commit_permission_issue(manager, loop):
project = Project()
vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager)
project.add_vm(vm)
directory = project.vm_working_directory(vm)
project.mark_vm_for_destruction(vm)
assert len(project._vms_to_destroy) == 1
assert os.path.exists(directory)
os.chmod(directory, 0)
with pytest.raises(aiohttp.web.HTTPInternalServerError):
loop.run_until_complete(asyncio.async(project.commit()))
os.chmod(directory, 700)
示例3: test_commit_permission_issue
# 需要导入模块: from gns3server.modules.project import Project [as 别名]
# 或者: from gns3server.modules.project.Project import commit [as 别名]
def test_commit_permission_issue(manager, loop):
"""
GNS3 will fix the permission and continue to delete
"""
project = Project()
vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager)
project.add_vm(vm)
directory = project.vm_working_directory(vm)
project.mark_vm_for_destruction(vm)
assert len(project._vms_to_destroy) == 1
assert os.path.exists(directory)
os.chmod(directory, 0)
loop.run_until_complete(asyncio.async(project.commit()))