mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Get project
This commit is contained in:
parent
0e76527ce2
commit
547adf0dc6
@ -39,6 +39,24 @@ class ProjectHandler:
|
|||||||
)
|
)
|
||||||
response.json(p)
|
response.json(p)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
@Route.get(
|
||||||
|
r"/project/{uuid}",
|
||||||
|
description="Get project informations",
|
||||||
|
parameters={
|
||||||
|
"uuid": "Project instance UUID",
|
||||||
|
},
|
||||||
|
status_codes={
|
||||||
|
200: "OK",
|
||||||
|
404: "Project instance doesn't exist"
|
||||||
|
},
|
||||||
|
output=PROJECT_OBJECT_SCHEMA)
|
||||||
|
def show(request, response):
|
||||||
|
|
||||||
|
pm = ProjectManager.instance()
|
||||||
|
project = pm.get_project(request.match_info["uuid"])
|
||||||
|
response.json(project)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@Route.put(
|
@Route.put(
|
||||||
r"/project/{uuid}",
|
r"/project/{uuid}",
|
||||||
|
@ -60,6 +60,19 @@ def test_create_project_with_uuid(server):
|
|||||||
assert response.json["location"] == "/tmp"
|
assert response.json["location"] == "/tmp"
|
||||||
|
|
||||||
|
|
||||||
|
def test_show_project(server):
|
||||||
|
query = {"uuid": "00010203-0405-0607-0809-0a0b0c0d0e0f", "location": "/tmp", "temporary": False}
|
||||||
|
response = server.post("/project", query)
|
||||||
|
assert response.status == 200
|
||||||
|
response = server.get("/project/00010203-0405-0607-0809-0a0b0c0d0e0f")
|
||||||
|
assert response.json == query
|
||||||
|
|
||||||
|
|
||||||
|
def test_show_project_invalid_uuid(server):
|
||||||
|
response = server.get("/project/00010203-0405-0607-0809-0a0b0c0d0e42")
|
||||||
|
assert response.status == 404
|
||||||
|
|
||||||
|
|
||||||
def test_update_temporary_project(server):
|
def test_update_temporary_project(server):
|
||||||
query = {"temporary": True}
|
query = {"temporary": True}
|
||||||
response = server.post("/project", query)
|
response = server.post("/project", query)
|
||||||
|
Loading…
Reference in New Issue
Block a user