mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Merge branch '2.2' into 3.0
# Conflicts: # gns3server/compute/base_node.py # gns3server/compute/docker/__init__.py # gns3server/compute/qemu/qemu_vm.py # gns3server/controller/compute.py # gns3server/controller/gns3vm/virtualbox_gns3_vm.py # gns3server/controller/node.py # gns3server/controller/project.py # gns3server/crash_report.py # gns3server/handlers/api/controller/template_handler.py # gns3server/static/web-ui/index.html # gns3server/static/web-ui/main.8448c96e4facbe79a613.js # gns3server/version.py # tests/compute/iou/test_iou_vm.py # tests/compute/qemu/test_qemu_vm.py # tests/handlers/api/controller/test_template.py
This commit is contained in:
commit
1ff23348d3
23 files changed
+763
-138
No files matched your search
@@ -98,6 +98,7 @@ async def test_start(vm):
|
||||
|
||||
with asyncio_patch("asyncio.create_subprocess_exec", return_value=mock_process) as mock_exec:
|
||||
mock_process.returncode = None
|
||||
mock_process.communicate = AsyncioMagicMock(return_value=(None, None))
|
||||
await vm.start()
|
||||
assert vm.is_running()
|
||||
assert vm.command_line == ' '.join(mock_exec.call_args[0])
|
||||
@@ -127,6 +128,7 @@ async def test_start_with_iourc(vm, tmpdir, config):
|
||||
config.settings.IOU.iourc_path = fake_file
|
||||
with asyncio_patch("asyncio.create_subprocess_exec", return_value=mock_process) as exec_mock:
|
||||
mock_process.returncode = None
|
||||
mock_process.communicate = AsyncioMagicMock(return_value=(None, None))
|
||||
await vm.start()
|
||||
assert vm.is_running()
|
||||
arsgs, kwargs = exec_mock.call_args
|
||||
@@ -164,11 +166,12 @@ async def test_stop(vm):
|
||||
future = asyncio.Future()
|
||||
future.set_result(True)
|
||||
process.wait.return_value = future
|
||||
process.returncode = None
|
||||
process.communicate = AsyncioMagicMock(return_value=(None, None))
|
||||
|
||||
with asyncio_patch("asyncio.create_subprocess_exec", return_value=process):
|
||||
with asyncio_patch("gns3server.utils.asyncio.wait_for_process_termination"):
|
||||
await vm.start()
|
||||
process.returncode = None
|
||||
assert vm.is_running()
|
||||
await vm.stop()
|
||||
assert vm.is_running() is False
|
||||
@@ -190,6 +193,7 @@ async def test_reload(vm, fake_iou_bin):
|
||||
future.set_result(True)
|
||||
process.wait.return_value = future
|
||||
process.returncode = None
|
||||
process.communicate = AsyncioMagicMock(return_value=(None, None))
|
||||
|
||||
with asyncio_patch("asyncio.create_subprocess_exec", return_value=process):
|
||||
with asyncio_patch("gns3server.utils.asyncio.wait_for_process_termination"):
|
||||
@@ -203,10 +207,13 @@ async def test_reload(vm, fake_iou_bin):
|
||||
@pytest.mark.asyncio
|
||||
async def test_close(vm, port_manager):
|
||||
|
||||
process = MagicMock()
|
||||
process.returncode = None
|
||||
process.communicate = AsyncioMagicMock(return_value=(None, None))
|
||||
vm._start_ubridge = AsyncioMagicMock(return_value=True)
|
||||
vm._ubridge_send = AsyncioMagicMock()
|
||||
with asyncio_patch("gns3server.compute.iou.iou_vm.IOUVM._check_requirements", return_value=True):
|
||||
with asyncio_patch("asyncio.create_subprocess_exec", return_value=MagicMock()):
|
||||
with asyncio_patch("asyncio.create_subprocess_exec", return_value=process):
|
||||
await vm.start()
|
||||
port = vm.console
|
||||
await vm.close()
|
||||
|
||||
Reference in new issue
Block a user