当前位置: 首页>>代码示例>>Python>>正文


Python Project.vm_working_directory方法代码示例

本文整理汇总了Python中gns3server.modules.project.Project.vm_working_directory方法的典型用法代码示例。如果您正苦于以下问题:Python Project.vm_working_directory方法的具体用法?Python Project.vm_working_directory怎么用?Python Project.vm_working_directory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gns3server.modules.project.Project的用法示例。


在下文中一共展示了Project.vm_working_directory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_commit_permission_issue

# 需要导入模块: from gns3server.modules.project import Project [as 别名]
# 或者: from gns3server.modules.project.Project import vm_working_directory [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)
开发者ID:AshokVardhn,项目名称:gns3-server,代码行数:14,代码来源:test_project.py

示例2: test_commit

# 需要导入模块: from gns3server.modules.project import Project [as 别名]
# 或者: from gns3server.modules.project.Project import vm_working_directory [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
开发者ID:AshokVardhn,项目名称:gns3-server,代码行数:14,代码来源:test_project.py

示例3: test_commit_permission_issue

# 需要导入模块: from gns3server.modules.project import Project [as 别名]
# 或者: from gns3server.modules.project.Project import vm_working_directory [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()))
开发者ID:ravirajsdeshmukh,项目名称:gns3-server,代码行数:15,代码来源:test_project.py

示例4: test_vm_working_directory

# 需要导入模块: from gns3server.modules.project import Project [as 别名]
# 或者: from gns3server.modules.project.Project import vm_working_directory [as 别名]
def test_vm_working_directory(tmpdir, vm):
    with patch("gns3server.modules.project.Project.is_local", return_value=True):
        p = Project(location=str(tmpdir))
        assert p.vm_working_directory(vm) == os.path.join(str(tmpdir), p.id, 'project-files', vm.module_name, vm.id)
        assert os.path.exists(p.vm_working_directory(vm))
开发者ID:AshokVardhn,项目名称:gns3-server,代码行数:7,代码来源:test_project.py


注:本文中的gns3server.modules.project.Project.vm_working_directory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。