mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 22:11:14 +02:00
Fix API status code for start/stop/suspend/reload a node. Fixes #1353.
Fix issues with test. Update documentation.
This commit is contained in:
1 parent
f3b4cc0160
commit
0f496907a0
354 files changed
+9950
-10181
No files matched your search
@@ -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__()
|
||||
|
||||
|
||||
|
||||
+10
-10
@@ -24,27 +24,27 @@ def test_init_logger(caplog):
|
||||
|
||||
logger = init_logger(logging.DEBUG)
|
||||
logger.debug("DEBUG1")
|
||||
assert "DEBUG1" in caplog.text
|
||||
assert "DEBUG1" in caplog.text()
|
||||
logger.info("INFO1")
|
||||
assert "INFO1" in caplog.text
|
||||
assert "INFO1" in caplog.text()
|
||||
logger.warn("WARN1")
|
||||
assert "WARN1" in caplog.text
|
||||
assert "WARN1" in caplog.text()
|
||||
logger.error("ERROR1")
|
||||
assert "ERROR1" in caplog.text
|
||||
assert "ERROR1" in caplog.text()
|
||||
logger.critical("CRITICAL1")
|
||||
assert "CRITICAL1" in caplog.text
|
||||
assert "CRITICAL1" in caplog.text()
|
||||
|
||||
|
||||
def test_init_logger_quiet(caplog):
|
||||
|
||||
logger = init_logger(logging.DEBUG, quiet=True)
|
||||
logger.debug("DEBUG1")
|
||||
assert "DEBUG1" not in caplog.text
|
||||
assert "DEBUG1" not in caplog.text()
|
||||
logger.info("INFO1")
|
||||
assert "INFO1" not in caplog.text
|
||||
assert "INFO1" not in caplog.text()
|
||||
logger.warn("WARN1")
|
||||
assert "WARN1" not in caplog.text
|
||||
assert "WARN1" not in caplog.text()
|
||||
logger.error("ERROR1")
|
||||
assert "ERROR1" not in caplog.text
|
||||
assert "ERROR1" not in caplog.text()
|
||||
logger.critical("CRITICAL1")
|
||||
assert "CRITICAL1" not in caplog.text
|
||||
assert "CRITICAL1" not in caplog.text()
|
||||
Reference in new issue
Block a user