{ "info": { "_postman_id": "b28840a8-20dc-4982-8436-4c56e08d7d70", "name": "Lambda CRUD", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { "name": "HELLO", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{endpoint}}", "host": [ "{{endpoint}}" ] } }, "response": [] }, { "name": "CREATE", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 201\", function () {", " pm.response.to.have.status(201);", "});", "pm.collectionVariables.unset(\"id\")", "pm.collectionVariables.set(\"id\",pm.response.json().id)" ], "type": "text/javascript" } } ], "request": { "method": "PUT", "header": [ { "key": "Authorization", "value": "SignedHeaders", "type": "text", "disabled": true }, { "key": "Date", "value": "{{$timestamp}}", "type": "text", "disabled": true } ], "body": { "mode": "raw", "raw": "{\"key\":\"value\",\"hello\":\"hello\"}" }, "url": { "raw": "{{endpoint}}/crud", "host": [ "{{endpoint}}" ], "path": [ "crud" ] } }, "response": [] }, { "name": "CREATE no body", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 400\", function () {", " pm.response.to.have.status(400);", "});" ], "type": "text/javascript" } } ], "request": { "method": "PUT", "header": [ { "key": "Authorization", "type": "text", "value": "SignedHeaders", "disabled": true }, { "key": "Date", "type": "text", "value": "{{$timestamp}}", "disabled": true } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "{{endpoint}}/crud", "host": [ "{{endpoint}}" ], "path": [ "crud" ] } }, "response": [] }, { "name": "UPDATE no body", "event": [ { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } }, { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 400\", function () {", " pm.response.to.have.status(400);", "});" ], "type": "text/javascript" } } ], "request": { "method": "PATCH", "header": [], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "{{endpoint}}/crud?id={{id}}", "host": [ "{{endpoint}}" ], "path": [ "crud" ], "query": [ { "key": "id", "value": "{{id}}" } ] } }, "response": [] }, { "name": "UPDATE empty body", "event": [ { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } }, { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 400\", function () {", " pm.response.to.have.status(400);", "});" ], "type": "text/javascript" } } ], "request": { "method": "PATCH", "header": [], "body": { "mode": "raw", "raw": "{}" }, "url": { "raw": "{{endpoint}}/crud?id={{id}}", "host": [ "{{endpoint}}" ], "path": [ "crud" ], "query": [ { "key": "id", "value": "{{id}}" } ] } }, "response": [] }, { "name": "UPDATE no id", "event": [ { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } }, { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 400\", function () {", " pm.response.to.have.status(400);", "});" ], "type": "text/javascript" } } ], "request": { "method": "PATCH", "header": [], "body": { "mode": "raw", "raw": "{\"hello\":\"bonjour\"}" }, "url": { "raw": "{{endpoint}}/crud", "host": [ "{{endpoint}}" ], "path": [ "crud" ] } }, "response": [] }, { "name": "UPDATE inexistant id", "event": [ { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } }, { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 204\", function () {", " pm.response.to.have.status(204);", "});" ], "type": "text/javascript" } } ], "request": { "method": "PATCH", "header": [], "body": { "mode": "raw", "raw": "{\"hello\":\"bonjour\"}" }, "url": { "raw": "{{endpoint}}/crud?id=noid", "host": [ "{{endpoint}}" ], "path": [ "crud" ], "query": [ { "key": "id", "value": "noid" } ] } }, "response": [] }, { "name": "UPDATE", "event": [ { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } }, { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 204\", function () {", " pm.response.to.have.status(204);", "});" ], "type": "text/javascript" } } ], "request": { "method": "PATCH", "header": [], "body": { "mode": "raw", "raw": "{\"hello\":\"bonjour\"}" }, "url": { "raw": "{{endpoint}}/crud?id={{id}}", "host": [ "{{endpoint}}" ], "path": [ "crud" ], "query": [ { "key": "id", "value": "{{id}}" } ] } }, "response": [] }, { "name": "GET", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "pm.test(\"response have correct payload\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.hello).to.eql(\"bonjour\");", " pm.expect(jsonData.ID).to.eql(pm.collectionVariables.get(\"id\"));", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{endpoint}}/crud?id={{id}}", "host": [ "{{endpoint}}" ], "path": [ "crud" ], "query": [ { "key": "id", "value": "{{id}}" } ] } }, "response": [] }, { "name": "GET no id", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 400\", function () {", " pm.response.to.have.status(400);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{endpoint}}/crud", "host": [ "{{endpoint}}" ], "path": [ "crud" ] } }, "response": [] }, { "name": "GET item created after update", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "pm.test(\"response have correct payload\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.hello).to.eql(\"bonjour\");", " pm.expect(jsonData.ID).to.eql(\"noid\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{endpoint}}/crud?id=noid", "host": [ "{{endpoint}}" ], "path": [ "crud" ], "query": [ { "key": "id", "value": "noid" } ] } }, "response": [] }, { "name": "DELETE no id", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 400\", function () {", " pm.response.to.have.status(400);", "});" ], "type": "text/javascript" } } ], "request": { "method": "DELETE", "header": [], "url": { "raw": "{{endpoint}}/crud", "host": [ "{{endpoint}}" ], "path": [ "crud" ] } }, "response": [] }, { "name": "DELETE inexistant id", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "DELETE", "header": [], "url": { "raw": "{{endpoint}}/crud?id=noid", "host": [ "{{endpoint}}" ], "path": [ "crud" ], "query": [ { "key": "id", "value": "noid" } ] } }, "response": [] }, { "name": "DELETE item created after update", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "DELETE", "header": [], "url": { "raw": "{{endpoint}}/crud?id=noid", "host": [ "{{endpoint}}" ], "path": [ "crud" ], "query": [ { "key": "id", "value": "noid" } ] } }, "response": [] }, { "name": "DELETE", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "pm.collectionVariables.unset(\"id\")" ], "type": "text/javascript" } } ], "request": { "method": "DELETE", "header": [], "url": { "raw": "{{endpoint}}/crud?id={{id}}", "host": [ "{{endpoint}}" ], "path": [ "crud" ], "query": [ { "key": "id", "value": "{{id}}" } ] } }, "response": [] }, { "name": "GET inexistant id", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"response don't have payload\", function () {", " pm.response.to.not.have.body", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{endpoint}}/crud?id=noid", "host": [ "{{endpoint}}" ], "path": [ "crud" ], "query": [ { "key": "id", "value": "noid" } ] } }, "response": [] } ] }