From 4848eeabadbef01b39c6f7fae936b134ef728b9e Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Fri, 23 Jan 2015 16:21:26 +0100 Subject: [PATCH] Add missing curl example --- docs/api/examples/get_projectuuid.txt | 19 +++++++++++++++++++ docs/api/examples/get_vpcsuuid.txt | 2 +- docs/api/examples/post_virtualbox.txt | 2 +- docs/api/examples/post_vpcs.txt | 2 +- docs/api/examples/put_projectuuid.txt | 21 +++++++++++++++++++++ docs/api/projectuuid.rst | 12 ++++++++++++ tests/api/test_project.py | 4 ++-- 7 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 docs/api/examples/get_projectuuid.txt create mode 100644 docs/api/examples/put_projectuuid.txt diff --git a/docs/api/examples/get_projectuuid.txt b/docs/api/examples/get_projectuuid.txt new file mode 100644 index 00000000..bed046ad --- /dev/null +++ b/docs/api/examples/get_projectuuid.txt @@ -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" +} diff --git a/docs/api/examples/get_vpcsuuid.txt b/docs/api/examples/get_vpcsuuid.txt index a414aadd..616653fe 100644 --- a/docs/api/examples/get_vpcsuuid.txt +++ b/docs/api/examples/get_vpcsuuid.txt @@ -18,5 +18,5 @@ X-ROUTE: /vpcs/{uuid} "project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80", "script_file": null, "startup_script": null, - "uuid": "fbbcc900-7fd1-4fcc-bc70-5f7eee8397b9" + "uuid": "b37ef237-15aa-46a7-bdc5-8fa8657056c6" } diff --git a/docs/api/examples/post_virtualbox.txt b/docs/api/examples/post_virtualbox.txt index 53195c53..7b051df4 100644 --- a/docs/api/examples/post_virtualbox.txt +++ b/docs/api/examples/post_virtualbox.txt @@ -26,6 +26,6 @@ X-ROUTE: /virtualbox "linked_clone": false, "name": "VM1", "project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80", - "uuid": "2908d568-4a42-49e1-9628-d914f2fd545d", + "uuid": "767b6b21-2209-4d73-aec8-49e4a332709d", "vmname": "VM1" } diff --git a/docs/api/examples/post_vpcs.txt b/docs/api/examples/post_vpcs.txt index 186c71ea..2c8403fb 100644 --- a/docs/api/examples/post_vpcs.txt +++ b/docs/api/examples/post_vpcs.txt @@ -21,5 +21,5 @@ X-ROUTE: /vpcs "project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80", "script_file": null, "startup_script": null, - "uuid": "5a2735f9-c38a-459c-8b7d-70ec56b62a7f" + "uuid": "076902d4-97d2-4243-b4fb-374a381d4bc5" } diff --git a/docs/api/examples/put_projectuuid.txt b/docs/api/examples/put_projectuuid.txt new file mode 100644 index 00000000..90ba05a1 --- /dev/null +++ b/docs/api/examples/put_projectuuid.txt @@ -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" +} diff --git a/docs/api/projectuuid.rst b/docs/api/projectuuid.rst index 68680d7d..5eebd0bf 100644 --- a/docs/api/projectuuid.rst +++ b/docs/api/projectuuid.rst @@ -27,6 +27,12 @@ Output uuid ✔ string Project UUID +Sample session +*************** + + +.. literalinclude:: examples/get_projectuuid.txt + PUT /project/**{uuid}** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -61,6 +67,12 @@ Output uuid ✔ string Project UUID +Sample session +*************** + + +.. literalinclude:: examples/put_projectuuid.txt + DELETE /project/**{uuid}** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/api/test_project.py b/tests/api/test_project.py index eaa70982..cfbe5f81 100644 --- a/tests/api/test_project.py +++ b/tests/api/test_project.py @@ -64,7 +64,7 @@ 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") + response = server.get("/project/00010203-0405-0607-0809-0a0b0c0d0e0f", example=True) assert response.json == query @@ -78,7 +78,7 @@ def test_update_temporary_project(server): response = server.post("/project", query) assert response.status == 200 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.json["temporary"] is False