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

Get a stable example between tests for project creation

This commit is contained in:
Julien Duponchelle 2015-01-20 15:35:46 +01:00
parent 78237e9fb6
commit 531265eced
2 changed files with 21 additions and 12 deletions

View File

@ -1,20 +1,21 @@
curl -i -X POST 'http://localhost:8000/project' -d '{"location": "/private/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/pytest-330/test_create_project_with_dir0"}' curl -i -X POST 'http://localhost:8000/project' -d '{"location": "/tmp", "uuid": "00010203-0405-0607-0809-0a0b0c0d0e0f"}'
POST /project HTTP/1.1 POST /project HTTP/1.1
{ {
"location": "/private/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/pytest-330/test_create_project_with_dir0" "location": "/tmp",
"uuid": "00010203-0405-0607-0809-0a0b0c0d0e0f"
} }
HTTP/1.1 200 HTTP/1.1 200
CONNECTION: close CONNECTION: close
CONTENT-LENGTH: 171 CONTENT-LENGTH: 78
CONTENT-TYPE: application/json CONTENT-TYPE: application/json
DATE: Thu, 08 Jan 2015 16:09:15 GMT DATE: Thu, 08 Jan 2015 16:09:15 GMT
SERVER: Python/3.4 aiohttp/0.13.1 SERVER: Python/3.4 aiohttp/0.13.1
X-ROUTE: /project X-ROUTE: /project
{ {
"location": "/private/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/pytest-330/test_create_project_with_dir0", "location": "/tmp",
"uuid": "e7d2911f-e367-46d9-b426-25663d0bb601" "uuid": "00010203-0405-0607-0809-0a0b0c0d0e0f"
} }

View File

@ -26,20 +26,28 @@ from gns3server.version import __version__
def test_create_project_with_dir(server, tmpdir): def test_create_project_with_dir(server, tmpdir):
response = server.post('/project', {"location": str(tmpdir)}, example=True) response = server.post("/project", {"location": str(tmpdir)})
assert response.status == 200 assert response.status == 200
assert response.json['location'] == str(tmpdir) assert response.json["location"] == str(tmpdir)
def test_create_project_without_dir(server): def test_create_project_without_dir(server):
query = {} query = {}
response = server.post('/project', query) response = server.post("/project", query)
assert response.status == 200 assert response.status == 200
assert response.json['uuid'] is not None assert response.json["uuid"] is not None
def test_create_project_with_uuid(server): def test_create_project_with_uuid(server):
query = {'uuid': '00010203-0405-0607-0809-0a0b0c0d0e0f'} query = {"uuid": "00010203-0405-0607-0809-0a0b0c0d0e0f"}
response = server.post('/project', query) response = server.post("/project", query)
assert response.status == 200 assert response.status == 200
assert response.json['uuid'] is not None assert response.json["uuid"] == "00010203-0405-0607-0809-0a0b0c0d0e0f"
def test_create_project_with_uuid(server):
query = {"uuid": "00010203-0405-0607-0809-0a0b0c0d0e0f", "location": "/tmp"}
response = server.post("/project", query, example=True)
assert response.status == 200
assert response.json["uuid"] == "00010203-0405-0607-0809-0a0b0c0d0e0f"
assert response.json["location"] == "/tmp"