mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Merge branch 'master' into unstable
Conflicts: tests/modules/test_manager.py
This commit is contained in:
commit
5f6d1bfdd6
43 files changed
+608
-677
No files matched your search
@@ -18,10 +18,14 @@
|
||||
import pytest
|
||||
import os
|
||||
import stat
|
||||
import sys
|
||||
import uuid
|
||||
|
||||
from tests.utils import asyncio_patch
|
||||
from unittest.mock import patch, MagicMock, PropertyMock
|
||||
|
||||
pytestmark = pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def fake_iou_bin(tmpdir):
|
||||
@@ -91,11 +95,32 @@ def test_iou_create_with_params(server, project, base_params):
|
||||
|
||||
assert "initial-config.cfg" in response.json["initial_config"]
|
||||
with open(initial_config_file(project, response.json)) as f:
|
||||
assert f.read() == params["initial_config_content"]
|
||||
assert f.read() == "hostname test"
|
||||
|
||||
assert "iourc" in response.json["iourc_path"]
|
||||
|
||||
|
||||
def test_iou_create_initial_config_already_exist(server, project, base_params):
|
||||
"""We don't erase an initial config if already exist at project creation"""
|
||||
|
||||
vm_id = str(uuid.uuid4())
|
||||
initial_config_file_path = initial_config_file(project, {'vm_id': vm_id})
|
||||
with open(initial_config_file_path, 'w+') as f:
|
||||
f.write("echo hello")
|
||||
|
||||
params = base_params
|
||||
params["vm_id"] = vm_id
|
||||
params["initial_config_content"] = "hostname test"
|
||||
|
||||
response = server.post("/projects/{project_id}/iou/vms".format(project_id=project.id), params, example=True)
|
||||
assert response.status == 201
|
||||
assert response.route == "/projects/{project_id}/iou/vms"
|
||||
|
||||
assert "initial-config.cfg" in response.json["initial_config"]
|
||||
with open(initial_config_file(project, response.json)) as f:
|
||||
assert f.read() == "echo hello"
|
||||
|
||||
|
||||
def test_iou_get(server, project, vm):
|
||||
response = server.get("/projects/{project_id}/iou/vms/{vm_id}".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), example=True)
|
||||
assert response.status == 200
|
||||
|
||||
@@ -170,10 +170,7 @@ def test_qemu_nio_create_ethernet(server, vm):
|
||||
"ethernet_device": "eth0",
|
||||
},
|
||||
example=True)
|
||||
assert response.status == 201
|
||||
assert response.route == "/projects/{project_id}/qemu/vms/{vm_id}/adapters/{adapter_number:\d+}/ports/{port_number:\d+}/nio"
|
||||
assert response.json["type"] == "nio_generic_ethernet"
|
||||
assert response.json["ethernet_device"] == "eth0"
|
||||
assert response.status == 409
|
||||
|
||||
|
||||
def test_qemu_delete_nio(server, vm):
|
||||
|
||||
Reference in new issue
Block a user