mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-13 20:08:55 +00:00
API for deleting a link
This commit is contained in:
parent
ed291da566
commit
8fed1d9b9f
@ -114,3 +114,7 @@ class Hypervisor:
|
||||
@asyncio.coroutine
|
||||
def post(self, path, data={}):
|
||||
return (yield from self.httpQuery("POST", path, data))
|
||||
|
||||
@asyncio.coroutine
|
||||
def delete(self, path):
|
||||
return (yield from self.httpQuery("DELETE", path))
|
||||
|
@ -60,7 +60,7 @@ class LinkHandler:
|
||||
"link_id": "UUID of the link"
|
||||
},
|
||||
status_codes={
|
||||
201: "Link deleted",
|
||||
204: "Link deleted",
|
||||
400: "Invalid request"
|
||||
},
|
||||
description="Delete a link instance")
|
||||
@ -70,5 +70,5 @@ class LinkHandler:
|
||||
project = controller.getProject(request.match_info["project_id"])
|
||||
link = project.getLink(request.match_info["link_id"])
|
||||
yield from link.delete()
|
||||
response.set_status(201)
|
||||
response.set_status(204)
|
||||
response.json(link)
|
||||
|
@ -79,4 +79,4 @@ def test_delete_link(http_controller, tmpdir, project, hypervisor, async_run):
|
||||
project._links = {link.id: link}
|
||||
with asyncio_patch("gns3server.controller.udp_link.Link.delete"):
|
||||
response = http_controller.delete("/projects/{}/links/{}".format(project.id, link.id), example=True)
|
||||
assert response.status == 201
|
||||
assert response.status == 204
|
||||
|
Loading…
Reference in New Issue
Block a user