mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Merge branch '2.1' into 2.2
# Conflicts: # gns3server/compute/docker/docker_vm.py # gns3server/version.py
This commit is contained in:
commit
033f005bde
402 files changed
+11042
-10444
No files matched your search
@@ -165,7 +165,6 @@ def test_add_node_local(async_run, controller):
|
||||
"name": project._name,
|
||||
"project_id": project._id,
|
||||
"path": project._path,
|
||||
"variables": None
|
||||
})
|
||||
compute.post.assert_any_call('/projects/{}/vpcs/nodes'.format(project.id),
|
||||
data={'node_id': node.id,
|
||||
@@ -193,8 +192,7 @@ def test_add_node_non_local(async_run, controller):
|
||||
|
||||
compute.post.assert_any_call('/projects', data={
|
||||
"name": project._name,
|
||||
"project_id": project._id,
|
||||
"variables": None
|
||||
"project_id": project._id
|
||||
})
|
||||
compute.post.assert_any_call('/projects/{}/vpcs/nodes'.format(project.id),
|
||||
data={'node_id': node.id,
|
||||
@@ -234,8 +232,7 @@ def test_add_node_from_appliance(async_run, controller):
|
||||
compute.post.assert_any_call('/projects', data={
|
||||
"name": project._name,
|
||||
"project_id": project._id,
|
||||
"path": project._path,
|
||||
"variables": None
|
||||
"path": project._path
|
||||
})
|
||||
compute.post.assert_any_call('/projects/{}/vpcs/nodes'.format(project.id),
|
||||
data={'node_id': node.id,
|
||||
|
||||
@@ -36,6 +36,16 @@ def test_create_project_with_path(http_compute, tmpdir):
|
||||
assert response.json["project_id"] == "00010203-0405-0607-0809-0a0b0c0d0e0f"
|
||||
|
||||
|
||||
def test_create_project_with_path_and_empty_variables(http_compute, tmpdir):
|
||||
with patch("gns3server.compute.project.Project.is_local", return_value=True):
|
||||
response = http_compute.post("/projects", {
|
||||
"name": "test",
|
||||
"path": str(tmpdir), "project_id": "00010203-0405-0607-0809-0a0b0c0d0e0f",
|
||||
"variables": None})
|
||||
assert response.status == 201
|
||||
assert response.json["project_id"] == "00010203-0405-0607-0809-0a0b0c0d0e0f"
|
||||
|
||||
|
||||
def test_create_project_without_dir(http_compute):
|
||||
query = {"name": "test", "project_id": "10010203-0405-0607-0809-0a0b0c0d0e0f"}
|
||||
response = http_compute.post("/projects", query, example=True)
|
||||
|
||||
@@ -20,7 +20,7 @@ from tests.utils import asyncio_patch
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
@pytest.yield_fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
def vm(http_compute, project, vmx_path):
|
||||
|
||||
with asyncio_patch("gns3server.compute.vmware.vmware_vm.VMwareVM.create", return_value=True) as mock:
|
||||
@@ -33,7 +33,7 @@ def vm(http_compute, project, vmx_path):
|
||||
return response.json
|
||||
|
||||
|
||||
@pytest.yield_fixture
|
||||
@pytest.fixture
|
||||
def vmx_path(tmpdir):
|
||||
"""
|
||||
Return a fake VMX file
|
||||
|
||||
@@ -164,7 +164,7 @@ def test_start_node(http_controller, tmpdir, project, compute, node):
|
||||
compute.post = AsyncioMagicMock()
|
||||
|
||||
response = http_controller.post("/projects/{}/nodes/{}/start".format(project.id, node.id), example=True)
|
||||
assert response.status == 201
|
||||
assert response.status == 200
|
||||
assert response.json == node.__json__()
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ def test_stop_node(http_controller, tmpdir, project, compute, node):
|
||||
compute.post = AsyncioMagicMock()
|
||||
|
||||
response = http_controller.post("/projects/{}/nodes/{}/stop".format(project.id, node.id), example=True)
|
||||
assert response.status == 201
|
||||
assert response.status == 200
|
||||
assert response.json == node.__json__()
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ def test_suspend_node(http_controller, tmpdir, project, compute, node):
|
||||
compute.post = AsyncioMagicMock()
|
||||
|
||||
response = http_controller.post("/projects/{}/nodes/{}/suspend".format(project.id, node.id), example=True)
|
||||
assert response.status == 201
|
||||
assert response.status == 200
|
||||
assert response.json == node.__json__()
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ def test_reload_node(http_controller, tmpdir, project, compute, node):
|
||||
compute.post = AsyncioMagicMock()
|
||||
|
||||
response = http_controller.post("/projects/{}/nodes/{}/reload".format(project.id, node.id), example=True)
|
||||
assert response.status == 201
|
||||
assert response.status == 200
|
||||
assert response.json == node.__json__()
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user