mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
8 files changed
+114
-42
No files matched your search
@@ -149,7 +149,7 @@ def test_import_gns3vm_1_x(controller, controller_config_path, async_run):
|
||||
assert controller.gns3vm.settings["engine"] == "vmware"
|
||||
assert controller.gns3vm.settings["enable"]
|
||||
assert controller.gns3vm.settings["headless"]
|
||||
assert controller.gns3vm.settings["auto_stop"] is False
|
||||
assert controller.gns3vm.settings["when_exit"] == "keep"
|
||||
assert controller.gns3vm.settings["vmname"] == "GNS3 VM"
|
||||
|
||||
|
||||
@@ -408,12 +408,12 @@ def test_stop(controller, async_run):
|
||||
|
||||
def test_stop_vm(controller, async_run):
|
||||
"""
|
||||
Start the controller with a GNS3 VM running
|
||||
Stop GNS3 VM if configured
|
||||
"""
|
||||
controller.gns3vm.settings = {
|
||||
"enable": True,
|
||||
"engine": "vmware",
|
||||
"auto_stop": True
|
||||
"when_exit": "stop"
|
||||
}
|
||||
controller.gns3vm._current_engine().running = True
|
||||
with asyncio_patch("gns3server.controller.gns3vm.vmware_gns3_vm.VMwareGNS3VM.stop") as mock:
|
||||
@@ -421,6 +421,36 @@ def test_stop_vm(controller, async_run):
|
||||
assert mock.called
|
||||
|
||||
|
||||
def test_suspend_vm(controller, async_run):
|
||||
"""
|
||||
Suspend GNS3 VM if configured
|
||||
"""
|
||||
controller.gns3vm.settings = {
|
||||
"enable": True,
|
||||
"engine": "vmware",
|
||||
"when_exit": "suspend"
|
||||
}
|
||||
controller.gns3vm._current_engine().running = True
|
||||
with asyncio_patch("gns3server.controller.gns3vm.vmware_gns3_vm.VMwareGNS3VM.suspend") as mock:
|
||||
async_run(controller.stop())
|
||||
assert mock.called
|
||||
|
||||
|
||||
def test_keep_vm(controller, async_run):
|
||||
"""
|
||||
Keep GNS3 VM if configured
|
||||
"""
|
||||
controller.gns3vm.settings = {
|
||||
"enable": True,
|
||||
"engine": "vmware",
|
||||
"when_exit": "keep"
|
||||
}
|
||||
controller.gns3vm._current_engine().running = True
|
||||
with asyncio_patch("gns3server.controller.gns3vm.vmware_gns3_vm.VMwareGNS3VM.suspend") as mock:
|
||||
async_run(controller.stop())
|
||||
assert not mock.called
|
||||
|
||||
|
||||
def test_get_free_project_name(controller, async_run):
|
||||
|
||||
async_run(controller.add_project(project_id=str(uuid.uuid4()), name="Test"))
|
||||
|
||||
Reference in new issue
Block a user