From 283d3ffadcaa87dcee7527cf80eb78234818865e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lui=CC=81s=20Arteiro?= Date: Mon, 23 Jan 2023 18:27:14 +0000 Subject: [PATCH] feat: Adding new Tag API tests. #256 --- lib/api/MVP.json | 369 +---------------------------------------- lib/api/localhost.json | 52 +++++- 2 files changed, 44 insertions(+), 377 deletions(-) diff --git a/lib/api/MVP.json b/lib/api/MVP.json index 577b22bb..dc6450db 100644 --- a/lib/api/MVP.json +++ b/lib/api/MVP.json @@ -1,368 +1 @@ -{ - "folders": [ - { - "requests": [ - { - "v": "1", - "endpoint": "<>/api/items/<>", - "name": "Get item", - "params": [], - "headers": [ - { "active": true, "value": "application/json", "key": "accept" } - ], - "method": "GET", - "auth": { - "authType": "none", - "addTo": "Headers", - "authActive": true, - "value": "", - "key": "" - }, - "preRequestScript": "", - "testScript": "// Check status code is 2xx\npw.test(\"Status code is 2xx\", ()=> {\n pw.expect(pw.response.status).toBeLevel2xx();\n});\n\n// Check JSON response property\npw.test(\"Check JSON response property\", ()=> {\n pw.expect(pw.response.body.person_id).toBeType(\"number\");\n pw.expect(pw.response.body.status).toBeType(\"number\");\n});", - "body": { "contentType": null, "body": null } - }, - { - "v": "1", - "endpoint": "<>/api/items/<>", - "name": "Get item (404 - Item not found)", - "params": [], - "headers": [ - { "key": "accept", "value": "application/json", "active": true } - ], - "method": "GET", - "auth": { "authType": "none", "authActive": true }, - "preRequestScript": "", - "testScript": "// Check status code is 404\npw.test(\"Status code is 404\", ()=> {\n pw.expect(pw.response.status).toBe(404);\n});", - "body": { "body": null, "contentType": null } - }, - { - "testScript": "// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});", - "auth": { "authActive": true, "authType": "none" }, - "preRequestScript": "", - "params": [], - "body": { "body": null, "contentType": null }, - "name": "Get item (400 - Invalid ID)", - "v": "1", - "endpoint": "<>/api/items/<>", - "method": "GET", - "headers": [ - { "key": "accept", "active": true, "value": "application/json" } - ] - }, - { - "v": "1", - "endpoint": "<>/api/items", - "name": "Create item", - "params": [], - "headers": [ - { "key": "accept", "active": true, "value": "application/json" } - ], - "method": "POST", - "auth": { "authType": "none", "authActive": true }, - "preRequestScript": "", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\n// Check JSON response property\npw.test(\"Check JSON response property\", ()=> {\n pw.expect(pw.response.body.id).toBeType(\"number\");\n});", - "body": { - "body": "{\n \"text\": \"some text\"\n}", - "contentType": "application/json" - } - }, - { - "name": "Create item (400 - Invalid attributes)", - "endpoint": "<>/api/items", - "method": "POST", - "auth": { "authActive": true, "authType": "none" }, - "params": [], - "preRequestScript": "", - "v": "1", - "testScript": "// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});", - "body": { - "contentType": "application/json", - "body": "{\n \"invalid\": \"something\"\n}" - }, - "headers": [ - { "value": "application/json", "active": true, "key": "accept" } - ] - }, - { - "v": "1", - "endpoint": "<>/api/items/<>", - "name": "Update item", - "params": [], - "headers": [ - { "active": true, "value": "application/json", "key": "accept" } - ], - "method": "PUT", - "auth": { "authActive": true, "authType": "none" }, - "preRequestScript": "", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\n\n// Check JSON response property\npw.test(\"Check JSON response property\", ()=> {\n pw.expect(pw.response.body.person_id).toBeType(\"number\");\n pw.expect(pw.response.body.status).toBeType(\"number\");\n});", - "body": { - "body": "{\n \"text\": \"new updated text\"\n}", - "contentType": "application/json" - } - }, - { - "preRequestScript": "", - "params": [], - "body": { - "contentType": "application/json", - "body": "{\n \"text\": \"new updated text\"\n}" - }, - "v": "1", - "name": "Update item (404 - Item not found)", - "headers": [ - { "active": true, "value": "application/json", "key": "accept" } - ], - "method": "PUT", - "auth": { "authType": "none", "authActive": true }, - "endpoint": "<>/api/items/<>", - "testScript": "// Check status code is 404\npw.test(\"Status code is 404\", ()=> {\n pw.expect(pw.response.status).toBe(404);\n});" - }, - { - "v": "1", - "method": "PUT", - "body": { - "contentType": "application/json", - "body": "{\n \"invalid\": \"invalid\"\n}" - }, - "endpoint": "<>/api/items/<>", - "headers": [ - { "active": true, "key": "accept", "value": "application/json" } - ], - "params": [], - "preRequestScript": "", - "testScript": "// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});", - "name": "Update item (400 - Invalid attributes)", - "auth": { "authActive": true, "authType": "none" } - } - ], - "name": "Items", - "v": 1, - "folders": [] - }, - { - "v": 1, - "folders": [], - "name": "Timers", - "requests": [ - { - "body": { "body": null, "contentType": null }, - "method": "GET", - "name": "Get timers", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});", - "preRequestScript": "", - "v": "1", - "auth": { "authType": "none", "authActive": true }, - "params": [], - "headers": [ - { "key": "accept", "active": true, "value": "application/json" } - ], - "endpoint": "<>/api/items/<>/timers" - }, - { - "auth": { "authActive": true, "authType": "none" }, - "headers": [ - { "key": "accept", "active": true, "value": "application/json" } - ], - "endpoint": "<>/api/items/<>/timers/<>", - "preRequestScript": "", - "name": "Get timer", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});", - "body": { "contentType": null, "body": null }, - "params": [], - "v": "1", - "method": "GET" - }, - { - "headers": [ - { "active": true, "value": "application/json", "key": "accept" } - ], - "method": "GET", - "name": "Get timer (404 - Timer not found)", - "auth": { "authType": "none", "authActive": true }, - "params": [], - "v": "1", - "body": { "contentType": null, "body": null }, - "testScript": "// Check status code is 404\npw.test(\"Status code is 404\", ()=> {\n pw.expect(pw.response.status).toBe(404);\n});", - "preRequestScript": "", - "endpoint": "<>/api/items/<>/timers/<>" - }, - { - "testScript": "// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});", - "endpoint": "<>/api/items/<>/timers/<>", - "v": "1", - "method": "GET", - "body": { "contentType": null, "body": null }, - "auth": { "authType": "none", "authActive": true }, - "params": [], - "preRequestScript": "", - "headers": [ - { "value": "application/json", "key": "accept", "active": true } - ], - "name": "Get timer (400 - Invalid ID)" - }, - { - "endpoint": "<>/api/items/<>/timers", - "headers": [ - { "key": "accept", "value": "application/json", "active": true } - ], - "body": { - "body": "{\n \"start\": \"2023-01-11T17:40:44\"\n}", - "contentType": "application/json" - }, - "preRequestScript": "", - "v": "1", - "name": "Create timer (custom start)", - "auth": { "authActive": true, "authType": "none" }, - "method": "POST", - "params": [], - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\n// Check JSON response property\npw.test(\"Check JSON response property\", ()=> {\n pw.expect(pw.response.body.id).toBeType(\"number\");\n});" - }, - { - "auth": { "authActive": true, "authType": "none" }, - "endpoint": "<>/api/items/<>/timers", - "v": "1", - "method": "POST", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\n\n// Check JSON response property\npw.test(\"Check JSON response property\", ()=> {\n pw.expect(pw.response.body.id).toBeType(\"number\");\n});", - "params": [], - "name": "Create timer (no start)", - "preRequestScript": "", - "headers": [ - { "key": "accept", "active": true, "value": "application/json" } - ], - "body": { "contentType": null, "body": null } - }, - { - "headers": [ - { "key": "accept", "value": "application/json", "active": true } - ], - "endpoint": "<>/api/items/<>/timers", - "testScript": "// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});", - "params": [], - "v": "1", - "body": { - "body": "{\n \"start\": \"2023-01-11T17:40:44\",\n \"stop\": \"2023-01-11T17:40:40\"\n}", - "contentType": "application/json" - }, - "name": "Create timer (400 - Stop is after start) ", - "method": "POST", - "auth": { "authType": "none", "authActive": true }, - "preRequestScript": "" - }, - { - "name": "Create timer (400 - Invalid date format) ", - "body": { - "contentType": "application/json", - "body": "{\n \"start\": \"2023-invalid-01\"\n}" - }, - "headers": [ - { "active": true, "value": "application/json", "key": "accept" } - ], - "params": [], - "method": "POST", - "testScript": "// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});", - "v": "1", - "endpoint": "<>/api/items/<>/timers", - "preRequestScript": "", - "auth": { "authType": "none", "authActive": true } - }, - { - "v": "1", - "endpoint": "<>/api/items/<>/timers/<>", - "name": "Update timer", - "params": [], - "headers": [ - { "active": true, "key": "accept", "value": "application/json" } - ], - "method": "PUT", - "auth": { "authType": "none", "authActive": true }, - "preRequestScript": "", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\n// Check JSON response property\npw.test(\"Check JSON response property\", ()=> {\n pw.expect(pw.response.body.start).toBeType(\"string\");\n pw.expect(pw.response.body.stop).toBeType(\"string\");\n});", - "body": { - "contentType": "application/json", - "body": "{\n \"start\": \"2023-01-11T17:40:44\",\n \"stop\": \"2023-01-11T17:40:48\"\n}" - } - }, - { - "preRequestScript": "", - "endpoint": "<>/api/items/<>/timers/<>", - "params": [], - "v": "1", - "headers": [ - { "active": true, "value": "application/json", "key": "accept" } - ], - "testScript": "// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});", - "body": { - "body": "{\n \"start\": \"2023-invalid-01\"\n}", - "contentType": "application/json" - }, - "name": "Update timer (400 - Invalid date format)", - "method": "PUT", - "auth": { "authType": "none", "authActive": true } - }, - { - "preRequestScript": "", - "endpoint": "<>/api/items/<>/timers/<>", - "body": { - "contentType": "application/json", - "body": "{\n \"start\": \"2023-01-11T17:40:44\",\n \"stop\": \"2023-01-11T17:40:40\"\n}" - }, - "auth": { "authActive": true, "authType": "none" }, - "headers": [ - { "key": "accept", "active": true, "value": "application/json" } - ], - "v": "1", - "testScript": "// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});", - "name": "Update timer (400 - Stop is after start)", - "params": [], - "method": "PUT" - }, - { - "name": "Stop timer", - "method": "PUT", - "auth": { "authType": "none", "authActive": true }, - "params": [], - "v": "1", - "testScript": "// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});", - "headers": [ - { "key": "accept", "value": "application/json", "active": true } - ], - "body": { "body": null, "contentType": null }, - "preRequestScript": "", - "endpoint": "<>/api/timers/<>" - }, - { - "preRequestScript": "", - "headers": [ - { "active": true, "key": "accept", "value": "application/json" } - ], - "endpoint": "<>/api/timers/<>", - "body": { "body": null, "contentType": null }, - "method": "PUT", - "name": "Stop timer (403 - Timer has already been stopped)", - "v": "1", - "params": [], - "testScript": "\n\n// Check status code is 403\npw.test(\"Status code is 403\", ()=> {\n pw.expect(pw.response.status).toBe(403);\n});", - "auth": { "authType": "none", "authActive": true } - }, - { - "preRequestScript": "", - "body": { "contentType": null, "body": null }, - "v": "1", - "method": "PUT", - "name": "Stop timer (404 - Timer not found)", - "endpoint": "<>/api/timers/<>", - "auth": { "authActive": true, "authType": "none" }, - "testScript": "// Check status code is 404\npw.test(\"Status code is 404\", ()=> {\n pw.expect(pw.response.status).toBe(404);\n});", - "headers": [ - { "value": "application/json", "key": "accept", "active": true } - ], - "params": [] - } - ] - } - ], - "v": 1, - "name": "MVP", - "requests": [] -} +{"requests":[],"name":"MVP","v":1,"folders":[{"name":"Items","folders":[],"v":1,"requests":[{"endpoint":"<>/api/items/<>","method":"GET","auth":{"value":"","authType":"none","authActive":true,"key":"","addTo":"Headers"},"headers":[{"value":"application/json","active":true,"key":"accept"}],"body":{"contentType":null,"body":null},"v":"1","testScript":"// Check status code is 2xx\npw.test(\"Status code is 2xx\", ()=> {\n pw.expect(pw.response.status).toBeLevel2xx();\n});\n\n// Check JSON response property\npw.test(\"Check JSON response property\", ()=> {\n pw.expect(pw.response.body.person_id).toBeType(\"number\");\n pw.expect(pw.response.body.status).toBeType(\"number\");\n});","name":"Get item","preRequestScript":"","params":[]},{"body":{"contentType":null,"body":null},"auth":{"authActive":true,"authType":"none"},"headers":[{"key":"accept","active":true,"value":"application/json"}],"endpoint":"<>/api/items/<>","testScript":"// Check status code is 404\npw.test(\"Status code is 404\", ()=> {\n pw.expect(pw.response.status).toBe(404);\n});","params":[],"name":"Get item (404 - Item not found)","method":"GET","v":"1","preRequestScript":""},{"body":{"body":null,"contentType":null},"headers":[{"active":true,"value":"application/json","key":"accept"}],"testScript":"// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});","v":"1","params":[],"method":"GET","auth":{"authActive":true,"authType":"none"},"endpoint":"<>/api/items/<>","preRequestScript":"","name":"Get item (400 - Invalid ID)"},{"params":[],"body":{"contentType":"application/json","body":"{\n \"text\": \"some text\"\n}"},"auth":{"authActive":true,"authType":"none"},"v":"1","name":"Create item","preRequestScript":"","endpoint":"<>/api/items","method":"POST","headers":[{"active":true,"key":"accept","value":"application/json"}],"testScript":"// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\n// Check JSON response property\npw.test(\"Check JSON response property\", ()=> {\n pw.expect(pw.response.body.id).toBeType(\"number\");\n});"},{"preRequestScript":"","body":{"body":"{\n \"invalid\": \"something\"\n}","contentType":"application/json"},"method":"POST","params":[],"headers":[{"key":"accept","active":true,"value":"application/json"}],"v":"1","endpoint":"<>/api/items","auth":{"authType":"none","authActive":true},"testScript":"// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});","name":"Create item (400 - Invalid attributes)"},{"endpoint":"<>/api/items/<>","name":"Update item","v":"1","body":{"body":"{\n \"text\": \"new updated text\"\n}","contentType":"application/json"},"headers":[{"key":"accept","value":"application/json","active":true}],"auth":{"authType":"none","authActive":true},"testScript":"// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\n\n// Check JSON response property\npw.test(\"Check JSON response property\", ()=> {\n pw.expect(pw.response.body.person_id).toBeType(\"number\");\n pw.expect(pw.response.body.status).toBeType(\"number\");\n});","params":[],"preRequestScript":"","method":"PUT"},{"headers":[{"key":"accept","active":true,"value":"application/json"}],"method":"PUT","name":"Update item (404 - Item not found)","endpoint":"<>/api/items/<>","preRequestScript":"","params":[],"auth":{"authActive":true,"authType":"none"},"v":"1","body":{"contentType":"application/json","body":"{\n \"text\": \"new updated text\"\n}"},"testScript":"// Check status code is 404\npw.test(\"Status code is 404\", ()=> {\n pw.expect(pw.response.status).toBe(404);\n});"},{"headers":[{"active":true,"value":"application/json","key":"accept"}],"preRequestScript":"","endpoint":"<>/api/items/<>","method":"PUT","testScript":"// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});","params":[],"body":{"contentType":"application/json","body":"{\n \"invalid\": \"invalid\"\n}"},"v":"1","name":"Update item (400 - Invalid attributes)","auth":{"authActive":true,"authType":"none"}}]},{"name":"Timers","v":1,"folders":[],"requests":[{"headers":[{"key":"accept","active":true,"value":"application/json"}],"body":{"body":null,"contentType":null},"endpoint":"<>/api/items/<>/timers","auth":{"authType":"none","authActive":true},"method":"GET","name":"Get timers","params":[],"v":"1","preRequestScript":"","testScript":"// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});"},{"preRequestScript":"","method":"GET","body":{"contentType":null,"body":null},"auth":{"authActive":true,"authType":"none"},"endpoint":"<>/api/items/<>/timers/<>","params":[],"name":"Get timer","headers":[{"key":"accept","active":true,"value":"application/json"}],"testScript":"// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});","v":"1"},{"auth":{"authType":"none","authActive":true},"params":[],"name":"Get timer (404 - Timer not found)","body":{"contentType":null,"body":null},"headers":[{"key":"accept","active":true,"value":"application/json"}],"endpoint":"<>/api/items/<>/timers/<>","v":"1","method":"GET","preRequestScript":"","testScript":"// Check status code is 404\npw.test(\"Status code is 404\", ()=> {\n pw.expect(pw.response.status).toBe(404);\n});"},{"auth":{"authType":"none","authActive":true},"body":{"body":null,"contentType":null},"params":[],"testScript":"// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});","headers":[{"key":"accept","value":"application/json","active":true}],"name":"Get timer (400 - Invalid ID)","endpoint":"<>/api/items/<>/timers/<>","method":"GET","preRequestScript":"","v":"1"},{"v":"1","body":{"body":"{\n \"start\": \"2023-01-11T17:40:44\"\n}","contentType":"application/json"},"headers":[{"active":true,"key":"accept","value":"application/json"}],"params":[],"method":"POST","name":"Create timer (custom start)","preRequestScript":"","testScript":"// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\n// Check JSON response property\npw.test(\"Check JSON response property\", ()=> {\n pw.expect(pw.response.body.id).toBeType(\"number\");\n});","endpoint":"<>/api/items/<>/timers","auth":{"authType":"none","authActive":true}},{"v":"1","headers":[{"value":"application/json","key":"accept","active":true}],"preRequestScript":"","body":{"contentType":null,"body":null},"auth":{"authActive":true,"authType":"none"},"method":"POST","testScript":"// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\n\n// Check JSON response property\npw.test(\"Check JSON response property\", ()=> {\n pw.expect(pw.response.body.id).toBeType(\"number\");\n});","name":"Create timer (no start)","params":[],"endpoint":"<>/api/items/<>/timers"},{"method":"POST","preRequestScript":"","auth":{"authType":"none","authActive":true},"params":[],"v":"1","name":"Create timer (400 - Stop is after start) ","headers":[{"value":"application/json","active":true,"key":"accept"}],"testScript":"// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});","endpoint":"<>/api/items/<>/timers","body":{"contentType":"application/json","body":"{\n \"start\": \"2023-01-11T17:40:44\",\n \"stop\": \"2023-01-11T17:40:40\"\n}"}},{"method":"POST","v":"1","params":[],"auth":{"authType":"none","authActive":true},"headers":[{"value":"application/json","key":"accept","active":true}],"endpoint":"<>/api/items/<>/timers","preRequestScript":"","body":{"body":"{\n \"start\": \"2023-invalid-01\"\n}","contentType":"application/json"},"testScript":"// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});","name":"Create timer (400 - Invalid date format) "},{"preRequestScript":"","auth":{"authActive":true,"authType":"none"},"testScript":"// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\n// Check JSON response property\npw.test(\"Check JSON response property\", ()=> {\n pw.expect(pw.response.body.start).toBeType(\"string\");\n pw.expect(pw.response.body.stop).toBeType(\"string\");\n});","name":"Update timer","v":"1","endpoint":"<>/api/items/<>/timers/<>","headers":[{"value":"application/json","active":true,"key":"accept"}],"method":"PUT","params":[],"body":{"contentType":"application/json","body":"{\n \"start\": \"2023-01-11T17:40:44\",\n \"stop\": \"2023-01-11T17:40:48\"\n}"}},{"params":[],"body":{"contentType":"application/json","body":"{\n \"start\": \"2023-invalid-01\"\n}"},"endpoint":"<>/api/items/<>/timers/<>","v":"1","method":"PUT","name":"Update timer (400 - Invalid date format)","headers":[{"key":"accept","active":true,"value":"application/json"}],"testScript":"// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});","preRequestScript":"","auth":{"authActive":true,"authType":"none"}},{"method":"PUT","auth":{"authActive":true,"authType":"none"},"endpoint":"<>/api/items/<>/timers/<>","params":[],"preRequestScript":"","v":"1","testScript":"// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});","headers":[{"key":"accept","value":"application/json","active":true}],"body":{"contentType":"application/json","body":"{\n \"start\": \"2023-01-11T17:40:44\",\n \"stop\": \"2023-01-11T17:40:40\"\n}"},"name":"Update timer (400 - Stop is after start)"},{"body":{"contentType":null,"body":null},"name":"Stop timer","params":[],"v":"1","endpoint":"<>/api/timers/<>","testScript":"// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});","headers":[{"active":true,"key":"accept","value":"application/json"}],"method":"PUT","preRequestScript":"","auth":{"authType":"none","authActive":true}},{"method":"PUT","name":"Stop timer (403 - Timer has already been stopped)","body":{"body":null,"contentType":null},"endpoint":"<>/api/timers/<>","params":[],"testScript":"\n\n// Check status code is 403\npw.test(\"Status code is 403\", ()=> {\n pw.expect(pw.response.status).toBe(403);\n});","headers":[{"key":"accept","active":true,"value":"application/json"}],"v":"1","auth":{"authType":"none","authActive":true},"preRequestScript":""},{"method":"PUT","params":[],"name":"Stop timer (404 - Timer not found)","auth":{"authType":"none","authActive":true},"preRequestScript":"","headers":[{"value":"application/json","active":true,"key":"accept"}],"v":"1","endpoint":"<>/api/timers/<>","testScript":"// Check status code is 404\npw.test(\"Status code is 404\", ()=> {\n pw.expect(pw.response.status).toBe(404);\n});","body":{"contentType":null,"body":null}}]},{"v":1,"name":"Tags","folders":[],"requests":[{"v":"1","endpoint":"<>/api/tags/<>","name":"Get tag","params":[],"headers":[{"value":"application/json","active":true,"key":"accept"}],"method":"GET","auth":{"value":"","authType":"none","authActive":true,"key":"","addTo":"Headers"},"preRequestScript":"","testScript":"// Check status code is 2xx\npw.test(\"Status code is 2xx\", ()=> {\n pw.expect(pw.response.status).toBeLevel2xx();\n});\n\n// Check JSON response property\npw.test(\"Check JSON response property\", ()=> {\n pw.expect(pw.response.body.person_id).toBeType(\"number\");\n pw.expect(pw.response.body.text).toBeType(\"string\");\n\n \t// Color must be an hex color\n pw.expect(pw.response.body.color).toBeType(\"string\");\n pw.expect(pw.response.body.color).toHaveLength(7);\n pw.expect(pw.response.body.color).toInclude(\"#\");\n \n});","body":{"contentType":null,"body":null}},{"v":"1","endpoint":"<>/api/tags/<>","name":"Get tag (404 - Tag not found)","params":[],"headers":[{"key":"accept","active":true,"value":"application/json"}],"method":"GET","auth":{"authActive":true,"authType":"none"},"preRequestScript":"","testScript":"// Check status code is 404\npw.test(\"Status code is 404\", ()=> {\n pw.expect(pw.response.status).toBe(404);\n});","body":{"contentType":null,"body":null}},{"v":"1","endpoint":"<>/api/tags/<>","name":"Get tag (400 - Invalid ID)","params":[],"headers":[{"active":true,"value":"application/json","key":"accept"}],"method":"GET","auth":{"authActive":true,"authType":"none"},"preRequestScript":"","testScript":"// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});","body":{"body":null,"contentType":null}},{"v":"1","endpoint":"<>/api/tags","name":"Create tag","params":[],"headers":[{"active":true,"key":"accept","value":"application/json"}],"method":"POST","auth":{"authActive":true,"authType":"none"},"preRequestScript":"","testScript":"// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\n// Check JSON response property\npw.test(\"Check JSON response property\", ()=> {\n pw.expect(pw.response.body.id).toBeType(\"number\");\n});","body":{"contentType":"application/json","body":"{\n \"text\": \"tag text\",\n \"person_id\": 0,\n \"color\": \"#FFFFFF\"\n}"}},{"v":"1","endpoint":"<>/api/tags","name":"Create tag (no color provided)","params":[],"headers":[{"active":true,"key":"accept","value":"application/json"}],"method":"POST","auth":{"authActive":true,"authType":"none"},"preRequestScript":"","testScript":"// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\n// Check JSON response property\npw.test(\"Check JSON response property\", ()=> {\n pw.expect(pw.response.body.id).toBeType(\"number\");\n});","body":{"contentType":"application/json","body":"{\n \"text\": \"tag text 2\",\n \"person_id\": 0\n}"}},{"v":"1","endpoint":"<>/api/tags","name":"Create tag (400 - Invalid attributes)","params":[],"headers":[{"key":"accept","active":true,"value":"application/json"}],"method":"POST","auth":{"authType":"none","authActive":true},"preRequestScript":"","testScript":"// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});","body":{"body":"{\n \"text\": \"tag text\",\n \"color\": \"invalid color\"\n}","contentType":"application/json"}},{"v":"1","endpoint":"<>/api/tags/<>","name":"Update tag","params":[],"headers":[{"key":"accept","value":"application/json","active":true}],"method":"PUT","auth":{"authType":"none","authActive":true},"preRequestScript":"","testScript":"// Check status code is 200\npw.test(\"Status code is 200\", ()=> {\n pw.expect(pw.response.status).toBe(200);\n});\n\n\n// Check JSON response property\npw.test(\"Check JSON response property\", ()=> {\n pw.expect(pw.response.body.person_id).toBeType(\"number\");\n pw.expect(pw.response.body.text).toBeType(\"string\");\n\n \t\n \t// Color must be an hex color\n pw.expect(pw.response.body.color).toBeType(\"string\");\n pw.expect(pw.response.body.color).toHaveLength(7);\n pw.expect(pw.response.body.color).toInclude(\"#\");\n});","body":{"body":"{\n \"text\": \"new updated tag text\"\n}","contentType":"application/json"}},{"v":"1","endpoint":"<>/api/tags/<>","name":"Update tag (404 - Tag not found)","params":[],"headers":[{"key":"accept","active":true,"value":"application/json"}],"method":"PUT","auth":{"authActive":true,"authType":"none"},"preRequestScript":"","testScript":"// Check status code is 404\npw.test(\"Status code is 404\", ()=> {\n pw.expect(pw.response.status).toBe(404);\n});","body":{"contentType":"application/json","body":"{\n \"text\": \"new updated text\"\n}"}},{"v":"1","endpoint":"<>/api/tags/<>","name":"Update tag (400 - Invalid attributes)","params":[],"headers":[{"key":"accept","active":true,"value":"application/json"}],"method":"PUT","auth":{"authActive":true,"authType":"none"},"preRequestScript":"","testScript":"// Check status code is 400\npw.test(\"Status code is 400\", ()=> {\n pw.expect(pw.response.status).toBe(400);\n});","body":{"contentType":"application/json","body":"{\n \"text\": \"tag text\",\n \"color\": \"invalid color\"\n}"}}]}]} \ No newline at end of file diff --git a/lib/api/localhost.json b/lib/api/localhost.json index 6daedd25..91df5403 100644 --- a/lib/api/localhost.json +++ b/lib/api/localhost.json @@ -1,9 +1,43 @@ -{ - "host": "http://localhost:4000", - "item_id": "1", - "notfound_item_id": "-1", - "invalid_id": "invalid_id", - "timer_id": "1", - "notfound_timer_id": "-1", - "timer_id_to_stop": 2 -} \ No newline at end of file +[ + { + "name": "Localhost", + "variables": [ + { + "key": "host", + "value": "http://localhost:4000" + }, + { + "value": "1", + "key": "item_id" + }, + { + "value": "-1", + "key": "notfound_item_id" + }, + { + "value": "invalid_id", + "key": "invalid_id" + }, + { + "value": "1", + "key": "timer_id" + }, + { + "value": "-1", + "key": "notfound_timer_id" + }, + { + "value": "2", + "key": "timer_id_to_stop" + }, + { + "key": "tag_id", + "value": "1" + }, + { + "key": "notfound_tag_id", + "value": "-1" + } + ] + } +] \ No newline at end of file