Start GNS3 VM with the controller

Ref https://github.com/GNS3/gns3-gui/issues/1254
This commit is contained in:
Julien Duponchelle
2016-08-25 11:49:06 +02:00
parent 21b99ad9f9
commit fc8b4c3216
5 changed files with 170 additions and 6 deletions

View File

@ -19,6 +19,7 @@ import os
import uuid
import json
import pytest
import socket
import aiohttp
from unittest.mock import MagicMock
from tests.utils import AsyncioMagicMock, asyncio_patch
@ -252,6 +253,28 @@ def test_getProject(controller, async_run):
assert controller.get_project("dsdssd")
def test_start(controller, async_run):
async_run(controller.start())
assert len(controller.computes) == 1 # Local compute is created
assert controller.computes["local"].name == socket.gethostname()
def test_start_vm(controller, async_run):
"""
Start the controller with a GNS3 VM
"""
controller.gns3vm.settings = {
"enable": True,
"engine": "vmware"
}
with asyncio_patch("gns3server.controller.gns3vm.vmware_gns3_vm.VMwareGNS3VM.start") as mock:
async_run(controller.start())
assert mock.called
assert len(controller.computes) == 2 # Local compute and vm are created
assert "local" in controller.computes
assert "vm" in controller.computes
def test_stop(controller, async_run):
c = async_run(controller.add_compute(compute_id="test1"))
c._connected = True