mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-12-18 20:37:57 +00:00
Return status when you start / stop / suspend a node
Should avoid sync issues
This commit is contained in:
parent
324962def5
commit
cde28c849e
@ -182,7 +182,8 @@ class NodeHandler:
|
||||
project = Controller.instance().get_project(request.match_info["project_id"])
|
||||
node = project.get_node(request.match_info["node_id"])
|
||||
yield from node.start()
|
||||
response.set_status(204)
|
||||
response.json(node)
|
||||
response.set_status(201)
|
||||
|
||||
@Route.post(
|
||||
r"/projects/{project_id}/nodes/{node_id}/stop",
|
||||
@ -202,7 +203,8 @@ class NodeHandler:
|
||||
project = Controller.instance().get_project(request.match_info["project_id"])
|
||||
node = project.get_node(request.match_info["node_id"])
|
||||
yield from node.stop()
|
||||
response.set_status(204)
|
||||
response.json(node)
|
||||
response.set_status(201)
|
||||
|
||||
@Route.post(
|
||||
r"/projects/{project_id}/nodes/{node_id}/suspend",
|
||||
@ -222,7 +224,8 @@ class NodeHandler:
|
||||
project = Controller.instance().get_project(request.match_info["project_id"])
|
||||
node = project.get_node(request.match_info["node_id"])
|
||||
yield from node.suspend()
|
||||
response.set_status(204)
|
||||
response.json(node)
|
||||
response.set_status(201)
|
||||
|
||||
@Route.post(
|
||||
r"/projects/{project_id}/nodes/{node_id}/reload",
|
||||
@ -242,7 +245,8 @@ class NodeHandler:
|
||||
project = Controller.instance().get_project(request.match_info["project_id"])
|
||||
node = project.get_node(request.match_info["node_id"])
|
||||
yield from node.reload()
|
||||
response.set_status(204)
|
||||
response.json(node)
|
||||
response.set_status(201)
|
||||
|
||||
@Route.delete(
|
||||
r"/projects/{project_id}/nodes/{node_id}",
|
||||
|
@ -100,6 +100,7 @@ TOPOLOGY_SCHEMA = {
|
||||
"additionalProperties": False
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
import jsonschema
|
||||
import sys
|
||||
|
@ -146,7 +146,8 @@ 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 == 204
|
||||
assert response.status == 201
|
||||
assert response.json == node.__json__()
|
||||
|
||||
|
||||
def test_stop_node(http_controller, tmpdir, project, compute, node):
|
||||
@ -154,7 +155,8 @@ 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 == 204
|
||||
assert response.status == 201
|
||||
assert response.json == node.__json__()
|
||||
|
||||
|
||||
def test_suspend_node(http_controller, tmpdir, project, compute, node):
|
||||
@ -162,7 +164,8 @@ 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 == 204
|
||||
assert response.status == 201
|
||||
assert response.json == node.__json__()
|
||||
|
||||
|
||||
def test_reload_node(http_controller, tmpdir, project, compute, node):
|
||||
@ -170,7 +173,8 @@ 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 == 204
|
||||
assert response.status == 201
|
||||
assert response.json == node.__json__()
|
||||
|
||||
|
||||
def test_delete_node(http_controller, tmpdir, project, compute, node):
|
||||
|
Loading…
Reference in New Issue
Block a user