diff --git a/gns3server/handlers/api/controller/node_handler.py b/gns3server/handlers/api/controller/node_handler.py index ff404585..e56f3bae 100644 --- a/gns3server/handlers/api/controller/node_handler.py +++ b/gns3server/handlers/api/controller/node_handler.py @@ -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}", diff --git a/gns3server/schemas/topology.py b/gns3server/schemas/topology.py index 53b26738..db13b111 100644 --- a/gns3server/schemas/topology.py +++ b/gns3server/schemas/topology.py @@ -100,6 +100,7 @@ TOPOLOGY_SCHEMA = { "additionalProperties": False } + def main(): import jsonschema import sys diff --git a/tests/handlers/api/controller/test_node.py b/tests/handlers/api/controller/test_node.py index 759a5ea2..ca142bdb 100644 --- a/tests/handlers/api/controller/test_node.py +++ b/tests/handlers/api/controller/test_node.py @@ -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):