diff --git a/Bmore-Responsive.postman_collection.json b/Bmore-Responsive.postman_collection.json index a7126672..7eefd32a 100644 --- a/Bmore-Responsive.postman_collection.json +++ b/Bmore-Responsive.postman_collection.json @@ -1,886 +1,1321 @@ { "info": { - "_postman_id": "5ee3a91c-a54c-4b36-863f-61ca99e283d6", + "_postman_id": "c0693306-4e20-4fda-b114-cb59b9057a5c", "name": "Bmore-Responsive", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { - "name": "local", + "name": "user", "item": [ { - "name": "user", - "item": [ + "name": "Login with admin user", + "event": [ { - "name": "All Users", - "request": { - "method": "GET", - "header": [ - { - "key": "token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhvbWVyLnNpbXBzb25Ac2ZwcC5jb20iLCJpYXQiOjE1ODUwMDk5NTgsImV4cCI6MTU4NTA5NjM1OH0.-kvQxh85_r0ZOSyn5Ogn5wPhxGFMF8KGK9n8dZCIbRY", - "type": "text" - } + "listen": "test", + "script": { + "id": "19989e9e-11ee-476a-b986-5be021e89a45", + "exec": [ + "//grab the token and save it into \"token\" env variable", + "pm.environment.set(\"token\",pm.response.text());", + "", + "", + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "" ], - "url": { - "raw": "localhost:3000/user", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "user" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"email\": \"{{testAdminUsername}}\",\n\t\"password\": \"{{testAdminPassword}}\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, + "url": { + "raw": "{{baseUrl}}/user/login", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "user", + "login" + ] + } + }, + "response": [] + }, + { + "name": "All Users", + "event": [ { - "name": "Single User", - "request": { - "method": "GET", - "header": [ - { - "key": "token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhvbWVyLnNpbXBzb25Ac2ZwcC5jb20iLCJpYXQiOjE1ODUwMDk5NTgsImV4cCI6MTU4NTA5NjM1OH0.-kvQxh85_r0ZOSyn5Ogn5wPhxGFMF8KGK9n8dZCIbRY", - "type": "text" - } + "listen": "test", + "script": { + "id": "19a429d8-ad47-4502-ab20-9fda4c54ea87", + "exec": [ + "// grab the id of the first contatc returned for use in subsequent transactions", + "var jsonData = pm.response.json();", + "pm.environment.set(\"firstUserEmail\", jsonData.results[0].email);", + "", + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "url": { - "raw": "localhost:3000/user/homer.simpson@sfpp.com", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "user", - "homer.simpson@sfpp.com" - ] - } - }, - "response": [] - }, + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{baseUrl}}/user", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "user" + ] + } + }, + "response": [] + }, + { + "name": "Single User", + "event": [ { - "name": "User Login", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } + "listen": "test", + "script": { + "id": "3908e851-991d-4e9a-8255-ba21abdef273", + "exec": [ + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"email\": \"homer.simpson@sfpp.com\",\n\t\"password\": \"donuts\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "localhost:3000/user/login", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "user", - "login" - ] - } - }, - "response": [] + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" }, + "url": { + "raw": "{{baseUrl}}/user/{{firstUserEmail}}", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "user", + "{{firstUserEmail}}" + ] + } + }, + "response": [] + }, + { + "name": "Create user", + "event": [ { - "name": "Create user", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - }, - { - "key": "token", - "value": "replace me", - "type": "text" - } + "listen": "test", + "script": { + "id": "e6385331-050e-4ae5-94ff-3388f161bb55", + "exec": [ + "//get the email of the new user from the request and save it to env variable", + "//this will allow deletion of this in the Delete transaction", + "var reqBody = JSON.parse(request.data);", + "pm.environment.set(\"newUserEmail\", reqBody.email);", + "", + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"email\": \"homer.simpson@sfpp.com\",\n\t\"password\": \"donuts\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "localhost:3000/user", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "user" - ] - } + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" }, - "response": [] + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"email\": \"marge.simpson@sfpp.com\",\n\t\"password\": \"donuts\"\n}", + "options": { + "raw": { + "language": "json" + } + } }, + "url": { + "raw": "{{baseUrl}}/user", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "user" + ] + } + }, + "response": [] + }, + { + "name": "Update User", + "event": [ { - "name": "Update User", - "request": { - "method": "PUT", - "header": [ - { - "key": "token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhvbWVyLnNpbXBzb25Ac2ZwcC5jb20iLCJpYXQiOjE1ODUwMTAyODAsImV4cCI6MTU4NTA5NjY4MH0.D5k_tbQpa-R7gMGOBcGq9H4VgPcB-Or8Lyaa7EgPsic", - "type": "text" - } + "listen": "test", + "script": { + "id": "9d93e390-dc13-42a1-8b78-c683b6c31e58", + "exec": [ + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"email\": \"homer.simpson@sfpp.com\",\n\t\"password\": \"donuts\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "localhost:3000/user", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "user" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"email\": \"{{testAdminUsername}}\",\n\t\"displayName\": \"Updated Name\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, + "url": { + "raw": "{{baseUrl}}/user", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "user" + ] + } + }, + "response": [] + }, + { + "name": "Deletes User", + "event": [ { - "name": "Deletes User", - "request": { - "method": "DELETE", - "header": [ - { - "key": "token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhvbWVyLnNpbXBzb25Ac2ZwcC5jb20iLCJpYXQiOjE1ODUwMTAzMzAsImV4cCI6MTU4NTA5NjczMH0.GJ9hWVtxz-8JDvFrG0STPxsyL2OJNKzPygSsTBzm1do", - "type": "text" - } + "listen": "test", + "script": { + "id": "13bf75ad-caf0-4fa9-afd7-f6d2a23dae15", + "exec": [ + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "url": { - "raw": "localhost:3000/user/homer.simpson@sfpp.com", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "user", - "homer.simpson@sfpp.com" - ] - } - }, - "response": [] + "type": "text/javascript" + } } ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, + "request": { + "method": "DELETE", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{baseUrl}}/user/{{newUserEmail}}", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "user", + "{{newUserEmail}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "userRole", + "item": [ { - "name": "userRole", - "item": [ + "name": "All roles", + "event": [ { - "name": "All roles", - "request": { - "method": "GET", - "header": [ - { - "key": "token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhvbWVyLnNpbXBzb25Ac2ZwcC5jb20iLCJpYXQiOjE1ODUwMTA0NDksImV4cCI6MTU4NTA5Njg0OX0.7HEFcqfaCB31Oiu23iMCQbMIK5t3cHYyQMrDdip0QYQ", - "type": "text" - } + "listen": "test", + "script": { + "id": "822834c8-3772-4bd1-9ec8-65e3f441455d", + "exec": [ + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "url": { - "raw": "localhost:3000/userRole", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "userRole" - ] - } - }, - "response": [] - }, + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{baseUrl}}/userRole", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "userRole" + ] + } + }, + "response": [] + }, + { + "name": "Create role", + "event": [ { - "name": "Single role", - "request": { - "method": "GET", - "header": [ - { - "key": "token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhvbWVyLnNpbXBzb25Ac2ZwcC5jb20iLCJpYXQiOjE1ODUwMTA0NDksImV4cCI6MTU4NTA5Njg0OX0.7HEFcqfaCB31Oiu23iMCQbMIK5t3cHYyQMrDdip0QYQ", - "type": "text" - } + "listen": "test", + "script": { + "id": "041e221d-c931-4b22-884a-73fefd1c1b80", + "exec": [ + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "url": { - "raw": "localhost:3000/userRole/1", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "userRole", - "1" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"role\": \"test4\",\n \"path\": \"/test\",\n \"method\": \"GET\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, + "url": { + "raw": "{{baseUrl}}/userRole", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "userRole" + ] + } + }, + "response": [] + }, + { + "name": "Removes a role", + "event": [ { - "name": "Create role", - "request": { - "method": "POST", - "header": [ - { - "key": "token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhvbWVyLnNpbXBzb25Ac2ZwcC5jb20iLCJpYXQiOjE1ODUwMTA0NDksImV4cCI6MTU4NTA5Njg0OX0.7HEFcqfaCB31Oiu23iMCQbMIK5t3cHYyQMrDdip0QYQ", - "type": "text" - } + "listen": "test", + "script": { + "id": "db7d2227-79fe-4dc9-bfee-a97248e53e12", + "exec": [ + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"role\": \"Safety Inspector\",\n\t\"description\": \"The Safety Inspector\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "localhost:3000/userRole", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "userRole" - ] - } - }, - "response": [] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"role\": \"test2\",\n \"path\": \"/test\",\n \"method\": \"GET\"\n}" }, + "url": { + "raw": "{{baseUrl}}/userRole/delete", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "userRole", + "delete" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "contact ", + "item": [ + { + "name": "All Contacts", + "event": [ { - "name": "Removes a role", - "request": { - "method": "DELETE", - "header": [ - { - "key": "token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhvbWVyLnNpbXBzb25Ac2ZwcC5jb20iLCJpYXQiOjE1ODUwMTA0NDksImV4cCI6MTU4NTA5Njg0OX0.7HEFcqfaCB31Oiu23iMCQbMIK5t3cHYyQMrDdip0QYQ", - "type": "text" - } + "listen": "test", + "script": { + "id": "376871ec-6bdf-4315-af89-90886bff9317", + "exec": [ + "// grab the id of the first contatc returned for use in subsequent transactions", + "var jsonData = pm.response.json();", + "pm.environment.set(\"firstContactId\", jsonData.results[0].id);", + "pm.environment.set(\"secondContactId\", jsonData.results[1].id);", + "", + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "" ], - "url": { - "raw": "localhost:3000/userRole/1", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "userRole", - "1" - ] - } - }, - "response": [] - }, + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "token", + "type": "text", + "value": "{{token}}" + } + ], + "url": { + "raw": "{{baseUrl}}/contact", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "contact" + ] + } + }, + "response": [] + }, + { + "name": "Single Contact", + "event": [ { - "name": "Updates a role", - "request": { - "method": "PUT", - "header": [ - { - "key": "token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhvbWVyLnNpbXBzb25Ac2ZwcC5jb20iLCJpYXQiOjE1ODUwMTA0NDksImV4cCI6MTU4NTA5Njg0OX0.7HEFcqfaCB31Oiu23iMCQbMIK5t3cHYyQMrDdip0QYQ", - "type": "text" - } + "listen": "test", + "script": { + "id": "075e31f9-3255-460a-9fa4-b112db37f39a", + "exec": [ + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n\t\"id\": 1,\n\t\"role\": \"Safety Inspector\",\n\t\"description\": \"This is a test role update\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "localhost:3000/userRole", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "userRole" - ] - } - }, - "response": [] + "type": "text/javascript" + } } ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true + "request": { + "method": "GET", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{baseUrl}}/contact/{{firstContactId}}", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "contact", + "{{firstContactId}}" + ] + } + }, + "response": [] }, { - "name": "contact", - "item": [ + "name": "Create Contact", + "event": [ { - "name": "All Contacts", - "request": { - "method": "GET", - "header": [ - { - "key": "token", - "type": "text", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhvbWVyLnNpbXBzb25Ac2ZwcC5jb20iLCJpYXQiOjE1ODUwMTA0NDksImV4cCI6MTU4NTA5Njg0OX0.7HEFcqfaCB31Oiu23iMCQbMIK5t3cHYyQMrDdip0QYQ" - } + "listen": "test", + "script": { + "id": "fa562b7d-4783-4cbb-a06b-e7b774023591", + "exec": [ + "//get the 36 character id of the new contact and save it to env variable", + "//this will allow deletion of this in the Delete transaction", + "pm.environment.set(\"newContactId\", pm.response.text().slice(0,36));", + "", + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "url": { - "raw": "localhost:3000/contact", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "contact" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"Rod Flanders\",\n \"email\": [\n {\n \"address\": \"rod.flanders@leftorium.com\",\n \"isPrimary\": \"true\"\n }\n ],\n \"phone\": [\n {\n \"number\": \"12345551212\",\n \"isPrimary\": \"true\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, + "url": { + "raw": "{{baseUrl}}/contact", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "contact" + ] + } + }, + "response": [] + }, + { + "name": "Update Contact", + "event": [ { - "name": "Single Contact", - "request": { - "method": "GET", - "header": [ - { - "key": "token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhvbWVyLnNpbXBzb25Ac2ZwcC5jb20iLCJpYXQiOjE1ODUwMTA0NDksImV4cCI6MTU4NTA5Njg0OX0.7HEFcqfaCB31Oiu23iMCQbMIK5t3cHYyQMrDdip0QYQ", - "type": "text" - } + "listen": "test", + "script": { + "id": "6f1765bb-101a-40d0-904f-37af9aa96558", + "exec": [ + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "url": { - "raw": "localhost:3000/contact/ea95bc14-472c-4e9a-a421-98dbe34b4cdf", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "contact", - "ea95bc14-472c-4e9a-a421-98dbe34b4cdf" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"id\": \"{{firstContactId}}\",\n \"name\": \"Rod Flanders\",\n \"email\": [\n {\n \"address\": \"rod.flanders@leftorium.com\",\n \"isPrimary\": \"true\"\n },\n {\n \"address\": \"nrod@church.org\"\n }\n ],\n \"phone\": [\n {\n \"number\": \"4105551212\",\n \"isPrimary\": \"true\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, + "url": { + "raw": "{{baseUrl}}/contact", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "contact" + ] + } + }, + "response": [] + }, + { + "name": "Deletes Contact", + "event": [ { - "name": "Create Contact", - "request": { - "method": "POST", - "header": [ - { - "key": "token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhvbWVyLnNpbXBzb25Ac2ZwcC5jb20iLCJpYXQiOjE1ODUwMTA0NDksImV4cCI6MTU4NTA5Njg0OX0.7HEFcqfaCB31Oiu23iMCQbMIK5t3cHYyQMrDdip0QYQ", - "type": "text" - } + "listen": "test", + "script": { + "id": "7e59699f-e52f-47ac-b2aa-05fedf731131", + "exec": [ + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"Ned Flanders\",\n \"email\": [\n {\n \"address\": \"ned.flanders@leftorium.com\",\n \"isPrimary\": \"true\"\n }\n ],\n \"phone\": [\n {\n \"number\": \"1234567890\",\n \"isPrimary\": \"true\"\n }\n ]\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "localhost:3000/contact", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "contact" - ] - } - }, - "response": [] - }, + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{baseUrl}}/contact/{{newContactId}}", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "contact", + "{{newContactId}}" + ] + } + }, + "response": [] + } + ], + "description": "This folder contains calls to excercise the contact endpoint. Please note that the these calls are expected to be made in order as some subsequent examples rely on values derived from previous calls. For exacmple the \"Get Single Contact\" retrieves the first contact returned from the previous \"Get All Contacts\" transaction.", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "e50ba8bc-02c6-40ba-ae51-57fa584d8aee", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "194a84e5-96bd-4efa-afa6-a7f770d99d85", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "entity", + "item": [ + { + "name": "All Entities", + "event": [ + { + "listen": "test", + "script": { + "id": "64a0b1b0-b208-4ad5-a1cd-2bed78440b07", + "exec": [ + "// grab the id of the first two entities returned for use in subsequent transactions", + "var jsonData = pm.response.json();", + "pm.environment.set(\"firstEntityId\", jsonData.results[0].id);", + "pm.environment.set(\"secondEntityId\", jsonData.results[1].id);", + "", + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "token", + "type": "text", + "value": "{{token}}" + } + ], + "url": { + "raw": "{{baseUrl}}/entity", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "entity" + ] + } + }, + "response": [] + }, + { + "name": "Single Entity", + "event": [ { - "name": "Update Contact", - "request": { - "method": "PUT", - "header": [ - { - "key": "token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhvbWVyLnNpbXBzb25Ac2ZwcC5jb20iLCJpYXQiOjE1ODUwMTA0NDksImV4cCI6MTU4NTA5Njg0OX0.7HEFcqfaCB31Oiu23iMCQbMIK5t3cHYyQMrDdip0QYQ", - "type": "text" - } + "listen": "test", + "script": { + "id": "126b51f5-5c6a-40eb-95b6-b0316f2e2e2e", + "exec": [ + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n \"id\": \"ea95bc14-472c-4e9a-a421-98dbe34b4cdf\",\n \"name\": \"Ned Flanders\",\n \"email\": [\n {\n \"address\": \"ned.flanders@leftorium.com\",\n \"isPrimary\": \"true\"\n },\n {\n \"address\": \"ned@church.org\"\n }\n ],\n \"phone\": [\n {\n \"number\": \"1234567890\",\n \"isPrimary\": \"true\"\n }\n ],\n \"EntityId\": \"1887bc7a-0210-498d-afa2-b11f5882df2c\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "localhost:3000/contact", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "contact" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{baseUrl}}/entity/{{firstEntityId}}", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "entity", + "{{firstEntityId}}" + ] + } + }, + "response": [] + }, + { + "name": "Create Entity", + "event": [ + { + "listen": "test", + "script": { + "id": "76ea05ba-36d2-45b2-acfa-425f1029860d", + "exec": [ + "//get the 36 character id of the new entity and save it to env variable", + "//this will allow deletion of this in the Delete transaction", + "pm.environment.set(\"newEntityId\", pm.response.text().slice(0,36));", + "", + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"Krustyland\"\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "Deletes Contact", - "request": { - "method": "DELETE", - "header": [ - { - "key": "token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhvbWVyLnNpbXBzb25Ac2ZwcC5jb20iLCJpYXQiOjE1ODUwMTA0NDksImV4cCI6MTU4NTA5Njg0OX0.7HEFcqfaCB31Oiu23iMCQbMIK5t3cHYyQMrDdip0QYQ", - "type": "text" - } - ], - "url": { - "raw": "localhost:3000/contact/d5da855f-e33c-4c87-80cb-9848c7903cb1", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "contact", - "d5da855f-e33c-4c87-80cb-9848c7903cb1" - ] - } - }, - "response": [] + "url": { + "raw": "{{baseUrl}}/entity", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "entity" + ] } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true + }, + "response": [] }, { - "name": "entity", - "item": [ + "name": "Update Entity", + "event": [ { - "name": "All Entities", - "request": { - "method": "GET", - "header": [ - { - "key": "token", - "type": "text", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhvbWVyLnNpbXBzb25Ac2ZwcC5jb20iLCJpYXQiOjE1ODUwMTA0NDksImV4cCI6MTU4NTA5Njg0OX0.7HEFcqfaCB31Oiu23iMCQbMIK5t3cHYyQMrDdip0QYQ" - } + "listen": "test", + "script": { + "id": "2393125b-9337-436e-ad40-816eed71e98a", + "exec": [ + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "url": { - "raw": "localhost:3000/entity", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "entity" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": " {\n \t\t\"id\": \"{{newEntityId}}\",\n \"email\": [\n {\n \"address\": \"hello@krustyland.com\",\n \"isPrimary\": \"true\"\n }\n ]\n }", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, + "url": { + "raw": "{{baseUrl}}/entity", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "entity" + ] + } + }, + "response": [] + }, + { + "name": "Deletes Entity", + "event": [ { - "name": "Single Entity", - "request": { - "method": "GET", - "header": [ - { - "key": "token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhvbWVyLnNpbXBzb25Ac2ZwcC5jb20iLCJpYXQiOjE1ODUwMTA0NDksImV4cCI6MTU4NTA5Njg0OX0.7HEFcqfaCB31Oiu23iMCQbMIK5t3cHYyQMrDdip0QYQ", - "type": "text" - } + "listen": "test", + "script": { + "id": "0c54a785-ee1e-4cb0-b9bb-b290937b50ff", + "exec": [ + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "url": { - "raw": "localhost:3000/entity/1887bc7a-0210-498d-afa2-b11f5882df2c", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "entity", - "1887bc7a-0210-498d-afa2-b11f5882df2c" - ] - } + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" }, - "response": [] - }, + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "url": { + "raw": "{{baseUrl}}/entity/{{newEntityId}}", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "entity", + "{{newEntityId}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "links", + "item": [ + { + "name": "Link Contact to Entities", + "event": [ { - "name": "Create Entity", - "request": { - "method": "POST", - "header": [ - { - "key": "token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhvbWVyLnNpbXBzb25Ac2ZwcC5jb20iLCJpYXQiOjE1ODUwMTA0NDksImV4cCI6MTU4NTA5Njg0OX0.7HEFcqfaCB31Oiu23iMCQbMIK5t3cHYyQMrDdip0QYQ", - "type": "text" - } + "listen": "test", + "script": { + "id": "1831285f-51de-45fb-9a68-e3c281951a44", + "exec": [ + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"The Leftorium\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "localhost:3000/entity", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "entity" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "token", + "type": "text", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"entities\": [\n {\n \"id\": \"{{firstEntityId}}\"\n },\n {\n \"id\": \"{{secondEntityId}}\",\n \"title\": \"Owner\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, + "url": { + "raw": "{{baseUrl}}/contact/link/{{firstContactId}}", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "contact", + "link", + "{{firstContactId}}" + ] + } + }, + "response": [] + }, + { + "name": "Link Entity to Contacts", + "event": [ { - "name": "Update Entity", - "request": { - "method": "PUT", - "header": [ - { - "key": "token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImhvbWVyLnNpbXBzb25Ac2ZwcC5jb20iLCJpYXQiOjE1ODUwMTA0NDksImV4cCI6MTU4NTA5Njg0OX0.7HEFcqfaCB31Oiu23iMCQbMIK5t3cHYyQMrDdip0QYQ", - "type": "text" - } + "listen": "test", + "script": { + "id": "63c5ec2a-d368-4014-9ffa-2ac4a4bce1a6", + "exec": [ + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" ], - "body": { - "mode": "raw", - "raw": " {\n \t\t\"id\": \"1887bc7a-0210-498d-afa2-b11f5882df2c\",\n \"email\": [\n {\n \"address\": \"hello@leftorium.com\",\n \"isPrimary\": \"true\"\n }\n ]\n }", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "localhost:3000/entity", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "entity" - ] + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"contacts\": [\n {\n \"id\": \"{{firstContactId}}\"\n },\n {\n \"id\": \"{{secondContactId}}\",\n \"title\": \"Owner\"\n }\n ]\n}\n\n", + "options": { + "raw": { + "language": "json" } - }, - "response": [] + } }, - { - "name": "Deletes Entity", - "request": { - "method": "DELETE", - "header": [ - { - "key": "token", - "value": "test", - "type": "text" - }, - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "url": { - "raw": "localhost:3000/contact/", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "contact", - "" - ] - } - }, - "response": [] + "url": { + "raw": "{{baseUrl}}/entity/link/{{firstEntityId}}", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "entity", + "link", + "{{firstEntityId}}" + ] } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true + }, + "response": [] + } + ], + "description": "These calls are exampled on how to create relationships between contacts and entities. These are put in their own folder in postman as they two sample calls require that Get All Contacts and Get All Entities have already been run.", + "event": [ + { + "listen": "prerequest", + "script": { + "id": "79b9e2be-9773-4ed5-87d9-46fa27c2d92e", + "type": "text/javascript", + "exec": [ + "" + ] + } }, { - "name": "csv", - "item": [ + "listen": "test", + "script": { + "id": "5c697ba8-81eb-487b-99f6-ab624dc9d589", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "protocolProfileBehavior": {} + }, + { + "name": "csv", + "item": [ + { + "name": "Contact CSV", + "event": [ { - "name": "Contact CSV", - "event": [ - { - "listen": "test", - "script": { - "id": "239399b3-c08e-4923-a615-c6e0008cac4f", - "exec": [ - "pm.test(\"Response time is less than \" + pm.environment.get(\"fastResponse\") + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(pm.environment.get(\"fastResponse\"), 10));", - "});", - "", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{baseUrl}}/csv/Contact", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "csv", - "Contact" - ] - } - }, - "response": [] + "listen": "test", + "script": { + "id": "737b2c37-bff3-45b8-b01a-02fdcca9e012", + "exec": [ + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" }, - { - "name": "Entity CSV", - "event": [ - { - "listen": "test", - "script": { - "id": "8931f00c-65c8-4739-bfa2-498aff694cbc", - "exec": [ - "pm.test(\"Response time is less than \" + pm.environment.get(\"fastResponse\") + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(pm.environment.get(\"fastResponse\"), 10));", - "});", - "", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{baseUrl}}/csv/Contact", + "host": [ + "{{baseUrl}}" ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{baseUrl}}/csv/Entity", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "csv", - "Entity" - ] - } - }, - "response": [] - }, + "path": [ + "csv", + "Contact" + ] + } + }, + "response": [] + }, + { + "name": "Entity CSV", + "event": [ { - "name": "User CSV", - "event": [ - { - "listen": "test", - "script": { - "id": "c3d8ac72-751f-4d3e-a329-72eb8d1b4185", - "exec": [ - "pm.test(\"Response time is less than \" + pm.environment.get(\"fastResponse\") + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(pm.environment.get(\"fastResponse\"), 10));", - "});", - "", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{baseUrl}}/csv/User", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "csv", - "User" - ] - } - }, - "response": [] + "listen": "test", + "script": { + "id": "8f8f78ba-eb6f-4c06-9939-7e0e7d2af5af", + "exec": [ + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" }, - { - "name": "UserRole CSV", - "event": [ - { - "listen": "test", - "script": { - "id": "3abcb65a-ca56-44da-bffb-fbfc6299da56", - "exec": [ - "pm.test(\"Response time is less than \" + pm.environment.get(\"fastResponse\") + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(pm.environment.get(\"fastResponse\"), 10));", - "});", - "", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } + "url": { + "raw": "{{baseUrl}}/csv/Entity", + "host": [ + "{{baseUrl}}" ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{baseUrl}}/csv/UserRole", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "csv", - "UserRole" - ] - } - }, - "response": [] + "path": [ + "csv", + "Entity" + ] } - ], + }, + "response": [] + }, + { + "name": "User CSV", "event": [ { - "listen": "prerequest", + "listen": "test", "script": { - "id": "d282190f-9ba1-4db8-a668-9e6c8ac4dbb3", - "type": "text/javascript", + "id": "5b84cbe0-f036-45bf-b973-f9bf869b5cb8", "exec": [ - "" - ] + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" } + ], + "body": { + "mode": "raw", + "raw": "" }, + "url": { + "raw": "{{baseUrl}}/csv/User", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "csv", + "User" + ] + } + }, + "response": [] + }, + { + "name": "UserRole CSV", + "event": [ { "listen": "test", "script": { - "id": "afc0880d-68db-4dc0-942c-fa5a86edbca5", - "type": "text/javascript", + "id": "7781e1ff-7c1f-4544-a554-063b098e08bb", "exec": [ - "" - ] + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" } } ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Heallthcheck (Express only)", "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "method": "GET", - "header": [], + "header": [ + { + "key": "token", + "value": "{{token}}", + "type": "text" + } + ], "body": { "mode": "raw", - "raw": "{\n\t\"test\": \"test1\"\n}", - "options": { - "raw": { - "language": "json" - } - } + "raw": "" }, "url": { - "raw": "localhost:3000/health", + "raw": "{{baseUrl}}/csv/UserRole", "host": [ - "localhost" + "{{baseUrl}}" ], - "port": "3000", "path": [ - "health" + "csv", + "UserRole" ] - }, - "description": "Checks the status of your Express app." + } }, "response": [] } ], + "event": [ + { + "listen": "prerequest", + "script": { + "id": "63407654-a4a9-4402-9e72-011815893577", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "1c17cf82-30be-4bd0-9efb-89e228067f49", + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], "protocolProfileBehavior": {} + }, + { + "name": "Heallthcheck (Express only)", + "event": [ + { + "listen": "test", + "script": { + "id": "ad699e86-0ff1-48e2-96aa-a339d48e14a1", + "exec": [ + "//confirm that request returns a success code of 200", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/health", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "health" + ] + }, + "description": "Checks the status of your Express app." + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "id": "3a7ed56b-06c9-4ed2-80df-1e3499f06ecd", + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "id": "eef185d7-4e91-4ea5-b251-1383ee21ef28", + "type": "text/javascript", + "exec": [ + "" + ] + } } ], "protocolProfileBehavior": {} diff --git a/Local.postman_environment.json b/Local.postman_environment.json new file mode 100644 index 00000000..44f60687 --- /dev/null +++ b/Local.postman_environment.json @@ -0,0 +1,29 @@ +{ + "id": "939f5b7d-687b-4f94-bda6-f356580f4833", + "name": "Local", + "values": [ + { + "key": "baseUrl", + "value": "http://localhost:3000", + "enabled": true + }, + { + "key": "testAdminUsername", + "value": "homer.simpson@sfpp.com", + "enabled": true + }, + { + "key": "testAdminPassword", + "value": "donuts", + "enabled": true + }, + { + "key": "token", + "value": "", + "enabled": true + } + ], + "_postman_variable_scope": "environment", + "_postman_exported_at": "2020-05-08T13:33:31.120Z", + "_postman_exported_using": "Postman/7.23.0" +} \ No newline at end of file