Success to add a dynamips with apiv2

This commit is contained in:
Julien Duponchelle committed 2016-03-15 10:45:05 +01:00
1 parent 8fed1d9b9f
commit 7a095478fe
8 files changed
+114 -13

No files matched your search

+5 -1
View File
@@ -27,7 +27,7 @@ import pytest
from unittest.mock import patch, MagicMock, PropertyMock
from tests.utils import asyncio_patch
from tests.utils import asyncio_patch, AsyncioMagicMock
from gns3server.handlers.api.controller.project_handler import ProjectHandler
from gns3server.controller import Controller
@@ -49,6 +49,10 @@ def project(http_controller, async_run):
def test_create_link(http_controller, tmpdir, project, hypervisor, async_run):
response = MagicMock()
response.json = {"console": 2048}
hypervisor.post = AsyncioMagicMock(return_value=response)
vm1 = async_run(project.addVM(hypervisor, None))
vm2 = async_run(project.addVM(hypervisor, None))
+7 -3
View File
@@ -26,8 +26,8 @@ import aiohttp
import pytest
from unittest.mock import patch, MagicMock, PropertyMock
from tests.utils import asyncio_patch
from unittest.mock import patch, MagicMock
from tests.utils import asyncio_patch, AsyncioMagicMock
from gns3server.handlers.api.controller.project_handler import ProjectHandler
from gns3server.controller import Controller
@@ -47,12 +47,16 @@ def project(http_controller, async_run):
def test_create_vm(http_controller, tmpdir, project, hypervisor):
response = MagicMock()
response.json = {"console": 2048}
hypervisor.post = AsyncioMagicMock(return_value=response)
response = http_controller.post("/projects/{}/vms".format(project.id), {
"name": "test",
"vm_type": "vpcs",
"hypervisor_id": "example.com",
"properties": {
"startup_script": "echo test"
"startup_script": "echo test"
}
}, example=True)
assert response.status == 201