1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-12 19:38:57 +00:00

Get project

This commit is contained in:
Julien Duponchelle 2015-01-23 16:18:40 +01:00
parent 0e76527ce2
commit 547adf0dc6
2 changed files with 31 additions and 0 deletions

View File

@ -39,6 +39,24 @@ class ProjectHandler:
)
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
@Route.put(
r"/project/{uuid}",

View File

@ -60,6 +60,19 @@ def test_create_project_with_uuid(server):
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):
query = {"temporary": True}
response = server.post("/project", query)