1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Add missing curl example

This commit is contained in:
Julien Duponchelle 2015-01-23 16:21:26 +01:00
parent 77ee6501b9
commit 4848eeabad
7 changed files with 57 additions and 5 deletions

View File

@ -0,0 +1,19 @@
curl -i -X GET 'http://localhost:8000/project/{uuid}'
GET /project/{uuid} HTTP/1.1
HTTP/1.1 200
CONNECTION: close
CONTENT-LENGTH: 102
CONTENT-TYPE: application/json
DATE: Thu, 08 Jan 2015 16:09:15 GMT
SERVER: Python/3.4 aiohttp/0.13.1
X-ROUTE: /project/{uuid}
{
"location": "/tmp",
"temporary": false,
"uuid": "00010203-0405-0607-0809-0a0b0c0d0e0f"
}

View File

@ -18,5 +18,5 @@ X-ROUTE: /vpcs/{uuid}
"project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80", "project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80",
"script_file": null, "script_file": null,
"startup_script": null, "startup_script": null,
"uuid": "fbbcc900-7fd1-4fcc-bc70-5f7eee8397b9" "uuid": "b37ef237-15aa-46a7-bdc5-8fa8657056c6"
} }

View File

@ -26,6 +26,6 @@ X-ROUTE: /virtualbox
"linked_clone": false, "linked_clone": false,
"name": "VM1", "name": "VM1",
"project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80", "project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80",
"uuid": "2908d568-4a42-49e1-9628-d914f2fd545d", "uuid": "767b6b21-2209-4d73-aec8-49e4a332709d",
"vmname": "VM1" "vmname": "VM1"
} }

View File

@ -21,5 +21,5 @@ X-ROUTE: /vpcs
"project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80", "project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80",
"script_file": null, "script_file": null,
"startup_script": null, "startup_script": null,
"uuid": "5a2735f9-c38a-459c-8b7d-70ec56b62a7f" "uuid": "076902d4-97d2-4243-b4fb-374a381d4bc5"
} }

View File

@ -0,0 +1,21 @@
curl -i -X PUT 'http://localhost:8000/project/{uuid}' -d '{"temporary": false}'
PUT /project/{uuid} HTTP/1.1
{
"temporary": false
}
HTTP/1.1 200
CONNECTION: close
CONTENT-LENGTH: 158
CONTENT-TYPE: application/json
DATE: Thu, 08 Jan 2015 16:09:15 GMT
SERVER: Python/3.4 aiohttp/0.13.1
X-ROUTE: /project/{uuid}
{
"location": "/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/tmps4qnfnar",
"temporary": false,
"uuid": "b3eccaca-af01-4244-a3fd-da1fb98d04c9"
}

View File

@ -27,6 +27,12 @@ Output
<tr><td>uuid</td> <td>&#10004;</td> <td>string</td> <td>Project UUID</td> </tr> <tr><td>uuid</td> <td>&#10004;</td> <td>string</td> <td>Project UUID</td> </tr>
</table> </table>
Sample session
***************
.. literalinclude:: examples/get_projectuuid.txt
PUT /project/**{uuid}** PUT /project/**{uuid}**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -61,6 +67,12 @@ Output
<tr><td>uuid</td> <td>&#10004;</td> <td>string</td> <td>Project UUID</td> </tr> <tr><td>uuid</td> <td>&#10004;</td> <td>string</td> <td>Project UUID</td> </tr>
</table> </table>
Sample session
***************
.. literalinclude:: examples/put_projectuuid.txt
DELETE /project/**{uuid}** DELETE /project/**{uuid}**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -64,7 +64,7 @@ def test_show_project(server):
query = {"uuid": "00010203-0405-0607-0809-0a0b0c0d0e0f", "location": "/tmp", "temporary": False} query = {"uuid": "00010203-0405-0607-0809-0a0b0c0d0e0f", "location": "/tmp", "temporary": False}
response = server.post("/project", query) response = server.post("/project", query)
assert response.status == 200 assert response.status == 200
response = server.get("/project/00010203-0405-0607-0809-0a0b0c0d0e0f") response = server.get("/project/00010203-0405-0607-0809-0a0b0c0d0e0f", example=True)
assert response.json == query assert response.json == query
@ -78,7 +78,7 @@ def test_update_temporary_project(server):
response = server.post("/project", query) response = server.post("/project", query)
assert response.status == 200 assert response.status == 200
query = {"temporary": False} query = {"temporary": False}
response = server.put("/project/{uuid}".format(uuid=response.json["uuid"]), query) response = server.put("/project/{uuid}".format(uuid=response.json["uuid"]), query, example=True)
assert response.status == 200 assert response.status == 200
assert response.json["temporary"] is False assert response.json["temporary"] is False