1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-24 15:58:08 +00:00

Project handler use ProjectManager

This commit is contained in:
Julien Duponchelle 2015-01-19 17:12:36 +01:00
parent f0094cc0d0
commit ed973dbcf2
2 changed files with 10 additions and 7 deletions

View File

@ -1,8 +1,8 @@
curl -i -xPOST 'http://localhost:8000/project' -d '{"location": "/private/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/pytest-240/test_create_project_with_dir0"}'
curl -i -xPOST 'http://localhost:8000/project' -d '{"location": "/private/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/pytest-253/test_create_project_with_dir0"}'
POST /project HTTP/1.1
{
"location": "/private/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/pytest-240/test_create_project_with_dir0"
"location": "/private/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/pytest-253/test_create_project_with_dir0"
}
@ -15,6 +15,6 @@ SERVER: Python/3.4 aiohttp/0.13.1
X-ROUTE: /project
{
"location": "/private/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/pytest-240/test_create_project_with_dir0",
"uuid": "16c371ee-728c-4bb3-8062-26b9313bd67d"
"location": "/private/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/pytest-253/test_create_project_with_dir0",
"uuid": "a8984692-a820-45de-8d4d-fc006b29072a"
}

View File

@ -17,7 +17,7 @@
from ..web.route import Route
from ..schemas.project import PROJECT_OBJECT_SCHEMA
from ..modules.project import Project
from ..modules.project_manager import ProjectManager
from aiohttp.web import HTTPConflict
@ -29,6 +29,9 @@ class ProjectHandler:
output=PROJECT_OBJECT_SCHEMA,
input=PROJECT_OBJECT_SCHEMA)
def create_project(request, response):
p = Project(location = request.json.get("location"),
uuid = request.json.get("uuid"))
pm = ProjectManager.instance()
p = pm.create_project(
location = request.json.get("location"),
uuid = request.json.get("uuid")
)
response.json(p)