From 0e36027a403c80b5a8192655537d9a831e07d1e0 Mon Sep 17 00:00:00 2001 From: "Nicole Bours(Desktop)" Date: Fri, 5 Mar 2021 10:42:15 +0100 Subject: [PATCH 01/19] acl + cleanup collecties --- Postman/dex-acl.postman_collection.json | 19008 ++++++++++++++++++ Postman/dex-cleanup.postman_collection.json | 391 + 2 files changed, 19399 insertions(+) create mode 100644 Postman/dex-acl.postman_collection.json create mode 100644 Postman/dex-cleanup.postman_collection.json diff --git a/Postman/dex-acl.postman_collection.json b/Postman/dex-acl.postman_collection.json new file mode 100644 index 00000000..bb24fe58 --- /dev/null +++ b/Postman/dex-acl.postman_collection.json @@ -0,0 +1,19008 @@ +{ + "info": { + "_postman_id": "94a3ee22-6e94-44ba-bd40-035ccf050ac1", + "name": "DEV-ACL", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "ACL", + "item": [ + { + "name": "Administrator", + "item": [ + { + "name": "User", + "item": [ + { + "name": "User-CreateUser-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var userName = pm.environment.get(\"userName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdUserId\", jsonData.id);", + "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"999\",\n \"name\": \"{{userName}}\",\n \"email\": \"User-CreateUser-Administrator@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-GetUser-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", + "var createdUserIdentityId = pm.environment.get(\"createdUserIdentityId\");", + "var userName = pm.environment.get(\"userName\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if updated identity Id matches: \" + createdUserIdentityId, function () {", + " pm.expect(jsonData.identityId).to.eql(createdUserIdentityId);", + "});", + "", + "pm.test(\"Check if updated Id matches: \" + createdUserId, function () {", + " pm.expect(jsonData.id).to.eql(createdUserId);", + "});", + "", + "pm.test(\"Check previously created UserName with id \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UpdateUser-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var userName = pm.environment.get(\"userNameUpdated\");", + "pm.environment.set(\"userName\", userName);", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if updated username matches: \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{userNameUpdated}}\",\r\n \"email\": \"User-CreateUser-Administrator\",\r\n \"identityId\": \"{{createdUserIdentityId}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-GetUpdatedUser-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", + "var createdUserIdentityId = pm.environment.get(\"createdUserIdentityId\");", + "var userName = pm.environment.get(\"userName\")", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if updated identity Id matches: \" + createdUserIdentityId, function () {", + " pm.expect(jsonData.identityId).to.eql(createdUserIdentityId);", + "});", + "", + "pm.test(\"Check if updated Id matches: \" + createdUserId, function () {", + " pm.expect(jsonData.id).to.eql(createdUserId);", + "});", + "", + "pm.test(\"Check if updated username matches: \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ], + "query": [ + { + "key": "", + "value": "", + "disabled": true + } + ] + } + }, + "response": [] + }, + { + "name": "User-GetUser-Self-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var administratorUserIdentityId = parseInt(pm.environment.get(\"administratorUserIdentityId\"));", + "", + "var jsonData = pm.response.json();", + "pm.environment.set(\"administratorUserId\", jsonData.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + administratorUserIdentityId, function () {", + " pm.expect(parseInt(jsonData.identityId)).to.eql(administratorUserIdentityId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "FollowUser", + "item": [ + { + "name": "User-FollowUser-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "var userIdToFollow = pm.environment.get(\"userIdToFollow\");", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userIdToFollow, function () {", + " pm.expect(jsonData.id).to.eql(userIdToFollow);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UnFollowUser-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Project", + "item": [ + { + "name": "Project-CreateProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", + "var projectName = pm.environment.get(\"projectName\");", + "var adminUserName = pm.environment.get(\"adminUserName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"projectId\", jsonData.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", + " pm.expect(jsonData.user.name).to.eql(adminUserName);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", + " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_Project-CreateProject-Administrator\",\r\n \"shortDescription\": \"postmantest_Project-CreateProject-Administrator\",\r\n \"uri\": \"postmantest_Project-CreateProject-Administrator\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Project-CreateProject-Administrator\",\r\n \"role\": \"postmantest_Project-CreateProject-Administrator\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetAllProjects-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findProject(jsonData, name) {", + " for (var i = 0; i < jsonData.results.length; i++) {", + " if (jsonData.results[i].name == name) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project: \" + projectName + \" is in list\", function () {", + " foundAt = findProject(jsonData, projectName);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectId = parseInt(pm.environment.get(\"projectId\"));", + "var projectName = pm.environment.get(\"projectName\");", + "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", + "var adminUserName = pm.environment.get(\"adminUserName\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"ProjectName is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", + " pm.expect(jsonData.user.name).to.eql(adminUserName);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", + " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UpdateProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectName = pm.environment.get(\"projectNameUpdated\");", + "pm.environment.set(\"projectName\", projectName);", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_Project-UpdateProject-Administrator\",\r\n \"shortDescription\": \"postmantest_Project-UpdateProject-Administrator\",\r\n \"uri\": \"postmantest_Project-UpdateProject-Administrator\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Project-UpdateProject-Administrator\",\r\n \"role\": \"postmantest_Project-UpdateProject-Administrator\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetUpdatedProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", + "var projectName = pm.environment.get(\"projectName\");", + "var adminUserName = pm.environment.get(\"adminUserName\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"ProjectName is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", + " pm.expect(jsonData.user.name).to.eql(adminUserName);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", + " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetProject-NonExisting-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/98989", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "98989" + ] + } + }, + "response": [] + }, + { + "name": "Project-LikeProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.ok;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "like", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteLikeProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.ok;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "like", + "{{projectId}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "FollowProject", + "item": [ + { + "name": "Project-FollowProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "var projectId = pm.environment.get(\"projectIdToFollow\");", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if created Username matches: \" + projectId, function () {", + " pm.expect(jsonData.id).to.eql(projectId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UnFollowProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Highlight", + "item": [ + { + "name": "Highlight-CreateHighlight-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightId\", jsonData.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postmantest_Highlight-CreateHighlight-Administrator\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetAllActiveHighlights-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectId = pm.environment.get(\"projectId\");", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findItem(jsonData, item) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].projectId == item) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight is in list and matching: \" + projectId, function () {", + " foundAt = findItem(jsonData, projectId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", + "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight Id matches: \" + highlightId, function () {", + " pm.expect(jsonData.id).to.eql(highlightId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-ByProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "var projectId = parseInt(pm.environment.get(\"projectId\"));", + "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findHighlightId(jsonData, item) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].id == item) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "function findProjectId(jsonData, item) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].projectId == item) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project is in list and matching: \" + projectId, function () {", + " foundAt = findProjectId(jsonData, projectId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "", + "pm.test(\"Highlight is in list and matching:\" + highlightId, function () {", + " foundAt = findHighlightId(jsonData, highlightId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-UpdateHighlight-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var highlightStartDate = pm.environment.get(\"highlightStartDate\");", + "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight Id matches: \" + highlightId, function () {", + " pm.expect(jsonData.id).to.eql(highlightId);", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postmantest_Highlight-UpdateHighlight-Administrator\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetUpdatedHighlight-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var highlightUpdateTimestamp = pm.environment.get(\"current_timestamp\");", + "var highlightEndDate = pm.environment.get(\"highlightEndDate\");", + "var highlightId = pm.environment.get(\"highlightId\");", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight Id matches: \" + highlightId, function () {", + " pm.expect(jsonData.id).to.eql(highlightId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-NonExisting-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/98989", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "98989" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Embed", + "item": [ + { + "name": "Embed-CreateEmbed-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"embedGuid\", jsonData.guid);", + "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetAllEmbeds-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var embedGuid = pm.environment.get(\"embedGuid\");", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findItem(jsonData, item) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].guid == item) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Embed is in list and matches: \" + embedGuid, function () {", + " foundAt = findItem(jsonData, embedGuid);", + " pm.expect(foundAt).to.not.eql(-1);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetEmbed-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Embed matches: \" + embeddedProjectId, function () {", + " pm.expect(jsonData.id).to.eql(embeddedProjectId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetEmbed-NonExisting-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/cdaadc49-b4b9-4c11-8937-e602174cba30", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "cdaadc49-b4b9-4c11-8937-e602174cba30" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetEmbed-NonExisting-NoGUID-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/98989", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "98989" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Role", + "item": [ + { + "name": "Role-CreateRole-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var scopeName = pm.environment.get(\"scopeName\");", + "var roleName = pm.environment.get(\"roleName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"roleId\", jsonData.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Role Name is set correctly and matching: \" + roleName, function () {", + " pm.expect(jsonData.name).to.eql(roleName);", + "});", + "", + "pm.test(\"Scope is correct and matching: \" + scopeName, function () {", + " pm.expect(jsonData.scopes.scope).to.eql(scopeName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + }, + "description": "Is deleted in the latest cleanup folder" + }, + "response": [] + }, + { + "name": "Role-GetAllRoles-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var roleName = pm.environment.get(\"roleName\");", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findProject(jsonData, name) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].name == name) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Role: \" + roleName + \" is in list\", function () {", + " foundAt = findProject(jsonData, roleName);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "", + "pm.test(\"Role Name is set correctly with matching: \" + roleName, function () {", + " pm.expect(jsonData[foundAt].name).to.eql(roleName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + } + }, + "response": [] + }, + { + "name": "Scope-GetAllScopes-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findProject(jsonData, name) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].name == name) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/Scopes", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "Scopes" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetRole-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var roleId = parseInt(pm.environment.get(\"roleId\"));", + "var roleName = pm.environment.get(\"roleName\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Role Name is set correctly\", function () {", + " pm.expect(jsonData.name).to.eql(roleName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + }, + { + "name": "Role-UpdateRole-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Role Name is set correctly\", function () {", + " pm.expect(jsonData.name).to.eql(updatedRoleName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetUpdatedRole-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Role Name is set correctly and matches: \" + updatedRoleName, function () {", + " pm.expect(jsonData.name).to.eql(updatedRoleName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + }, + { + "name": "Role-SetRole-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var roleId = parseInt(pm.environment.get(\"roleId\"));", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Role is set correctly and matches: \" + roleId, function () {", + " pm.expect(jsonData.role.id).to.eql(roleId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role/setRole?userId={{createdUserId}}&roleId={{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "setRole" + ], + "query": [ + { + "key": "userId", + "value": "{{createdUserId}}", + "description": "Id of the user that we want to update" + }, + { + "key": "roleId", + "value": "{{roleId}}", + "description": "Id of the role that you want to update the user with" + } + ] + } + }, + "response": [] + }, + { + "name": "User-GetRole-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var roleId = parseInt(pm.environment.get(\"roleId\"));", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if user has role that matches: \" + roleId, function () {", + " pm.expect(jsonData.role.id).to.eql(roleId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetRole-NonExisting-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/98989", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "98989" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Search", + "item": [ + { + "name": "Search-SearchInternal-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.results[0].name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Search/internal/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Search", + "internal", + "{{projectId}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Wizard", + "item": [] + }, + { + "name": "Institution", + "item": [ + { + "name": "Institution-CreateInstitution-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var institutionName = pm.environment.get(\"institutionName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdInstitutionId\", jsonData.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if created Name matches: \" + institutionName, function () {", + " pm.expect(jsonData.name).to.eql(institutionName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"{{institutionName}}\",\n \"description\": \"postmantest_Institution-CreateInstitution-Administrator\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Institution", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution" + ] + } + }, + "response": [] + }, + { + "name": "Institution-GetInstitution-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var createdInstitutionId = parseInt(pm.environment.get(\"createdInstitutionId\"));", + "var institutionName = pm.environment.get(\"institutionName\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if updated Id matches: \" + createdInstitutionId, function () {", + " pm.expect(jsonData.id).to.eql(createdInstitutionId);", + "});", + "", + "pm.test(\"Check previously created UserName with id \" + institutionName, function () {", + " pm.expect(jsonData.name).to.eql(institutionName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution", + "{{createdInstitutionId}}" + ] + } + }, + "response": [] + }, + { + "name": "Institution-UpdateInstitution-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var institutionName = pm.environment.get(\"updatedInstitutionName\");", + "pm.environment.set(\"institutionName\", institutionName);", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if updated Institution Name matches: \" + institutionName, function () {", + " pm.expect(jsonData.name).to.eql(institutionName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{updatedInstitutionName}}\",\r\n \"description\": \"postmantest_Institution-UpdateInstitution-Administrator\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution", + "{{createdInstitutionId}}" + ] + } + }, + "response": [] + }, + { + "name": "Institution-GetUpdatedInstitution-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var createdInstitutionId = parseInt(pm.environment.get(\"createdInstitutionId\"));", + "var institutionName = pm.environment.get(\"institutionName\")", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if updated Institution Id matches: \" + createdInstitutionId, function () {", + " pm.expect(jsonData.id).to.eql(createdInstitutionId);", + "});", + "", + "pm.test(\"Check if updated institution matches: \" + institutionName, function () {", + " pm.expect(jsonData.name).to.eql(institutionName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution", + "{{createdInstitutionId}}" + ], + "query": [ + { + "key": "", + "value": "", + "disabled": true + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "File", + "item": [ + { + "name": "File-CreateFile-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "pm.environment.set(\"adminFileId\", jsonData.id)\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than 800ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(800);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "Postman/testimage.png" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Files-GetAll-Adminstrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "File-Delete-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid\", function () {\r", + " pm.response.to.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File/{{adminFileId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File", + "{{adminFileId}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "CallToActionOption", + "item": [ + { + "name": "CallToActionOption-CreateCallToActionOption-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"callToActionOptionId\", jsonData.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Call to action option type is lowercase\", function () {", + " pm.expect(jsonData.type).to.eql(jsonData.type.toLowerCase());", + "});", + "", + "pm.test(\"Call to action option value is lowercase\", function () {", + " pm.expect(jsonData.value).to.eql(jsonData.value.toLowerCase());", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"type\": \"postman_CallToActionOption-CreateCallToActionOption-Administrator\",\r\n \"value\": \"postman_CallToActionOption-CreateCallToActionOption-Administrator\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-GetAllCallToActionOptions-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var optionId = parseInt(pm.environment.get(\"callToActionOptionId\"));", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findOption(jsonData, id) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].id == id) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Call to action option with id: \" + optionId + \" is in list\", function () {", + " foundAt = findOption(jsonData, optionId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-GetCallToActionOptionById-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"callToActionOptionType\", jsonData.type);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Call to action option type is lowercase\", function () {", + " pm.expect(jsonData.type).to.eql(jsonData.type.toLowerCase());", + "});", + "", + "pm.test(\"Call to action option value is lowercase\", function () {", + " pm.expect(jsonData.value).to.eql(jsonData.value.toLowerCase());", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"type\": \"Title\",\r\n \"value\": \"Collaborate\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-GetCallToActionOptionByType-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var callToActionOptionId = parseInt(pm.environment.get(\"callToActionOptionId\"));", + "", + "var jsonData = pm.response.json();", + "", + "function findOptionType(jsonData, id) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].id == id) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Call to action option id is \" + callToActionOptionId, function() {", + " foundAt = findOptionType(jsonData, callToActionOptionId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/type/{{callToActionOptionType}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "type", + "{{callToActionOptionType}}" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-UpdateCallToActionOption-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var updatedCallToActionType = pm.environment.get(\"updatedCallToActionType\");", + "var updatedCallToActionValue = pm.environment.get(\"updatedCallToActionValue\");", + "pm.environment.set(\"callToActionOptionType\", updatedCallToActionType);", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if updated Call to action Type matches: \" + updatedCallToActionType, function () {", + " pm.expect(jsonData.type).to.eql(updatedCallToActionType);", + "});", + "", + "pm.test(\"Check if updated Call to action Value matches: \" + updatedCallToActionValue, function () {", + " pm.expect(jsonData.value).to.eql(updatedCallToActionValue);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n\t\"type\": \"{{updatedCallToActionType}}\",\r\n \"value\": \"{{updatedCallToActionValue}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Cleanup", + "item": [ + { + "name": "Embed-DeleteEmbed-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-DeleteHighlight-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Role-DeleteRole-WithUsers-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + }, + { + "name": "Institution-DeleteInstitution-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution", + "{{createdInstitutionId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-DeleteUser-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-DeleteCallToActionOption-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Checkup-on-Cleanup", + "item": [ + { + "name": "Project-Get-Deleted-Project-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-Get-Deleted-User-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + }, + { + "name": "Embed-Get-Deleted-Embed-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-Get-Deleted-Highlight-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Institution-Get-Deleted-Institution-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.notFound;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution", + "{{createdInstitutionId}}" + ] + } + }, + "response": [] + } + ] + } + ] + }, + { + "name": "Guest", + "item": [ + { + "name": "Preparation", + "item": [ + { + "name": "Project-CreateProject", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", + "var projectName = pm.environment.get(\"projectName\");", + "var adminUserName = pm.environment.get(\"adminUserName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"projectId\", jsonData.id);", + "pm.environment.set(\"adminProjectId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", + " pm.expect(jsonData.user.name).to.eql(adminUserName);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", + " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_Guest_Project-CreateProject\",\r\n \"shortDescription\": \"postmantest_Guest_Project-CreateProject\",\r\n \"uri\": \"postmantest_Guest_Project-CreateProject-CreateProjecttest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Guest_Project-CreateProject\",\r\n \"role\": \"postmantest_Guest_Project-CreateProject\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-CreateHighlight", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postman_Highlight-CreateHighlight\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Embed-CreateEmbed", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"embedGuid\", jsonData.guid);", + "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-CreateCallToActionOption", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"callToActionOptionId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Call to action option type is lowercase\", function () {", + " pm.expect(jsonData.type).to.eql(jsonData.type.toLowerCase());", + "});", + "", + "pm.test(\"Call to action option value is lowercase\", function () {", + " pm.expect(jsonData.value).to.eql(jsonData.value.toLowerCase());", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"type\": \"Title\",\r\n \"value\": \"Feedback\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption" + ] + } + }, + "response": [] + } + ], + "description": "For some requests, we need to have data available. The variables need to be filled so the request can succeed. We put these preparation requests in this folder. We will clean them up in the cleanup folder.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "User", + "item": [ + { + "name": "User-CreateUser-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"postman_User-CreateUser-Guest\",\n \"email\": \"postman_User-CreateUser-Guest@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-GetUser-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + }, + { + "name": "User-UpdateUser-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + }, + { + "name": "User-DeleteUser-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "FollowUser", + "item": [ + { + "name": "User-FollowUser-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UnFollowUser-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Project", + "item": [ + { + "name": "Project-CreateProject-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetAllProjects-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findProject(jsonData, name) {", + " for (var i = 0; i < jsonData.results.length; i++) {", + " if (jsonData.results[i].name == name) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project: \" + projectName + \" is in list\", function () {", + " foundAt = findProject(jsonData, projectName);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "", + "pm.test(\"Project name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetProject-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UpdateProject-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteProject-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Project/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Project-LikeProject-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 401\", function () {\r", + " pm.response.to.have.status(401);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.unauthorized;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text", + "disabled": true + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "like", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteLikeProject-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 401\", function () {\r", + " pm.response.to.have.status(401);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.unauthorized;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text", + "disabled": true + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "like", + "{{projectId}}" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "FollowProject", + "item": [ + { + "name": "Project-FollowProject-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UnFollowProject-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Highlight", + "item": [ + { + "name": "Highlight-CreateHighlight-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetAllActiveHighlights-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", + "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight Id matches: \" + highlightId, function () {", + " pm.expect(jsonData.id).to.eql(highlightId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-ByProject-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-UpdateHighlight-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-DeleteHighlight-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Embed", + "item": [ + { + "name": "Embed-CreateEmbed-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetAllEmbeds-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetEmbed-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Embed-DeleteEmbed-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuid}}" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Role", + "item": [ + { + "name": "Role-CreateRole-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetAllRoles-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + } + }, + "response": [] + }, + { + "name": "Scope-GetAllScopes-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Role/Scopes", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "Scopes" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetRole-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Role/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Role-UpdateRole-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Role-SetRole-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"createdUserId\": {{createdUserId}},\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId=1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "setRole" + ], + "query": [ + { + "key": "createdUserId", + "value": "{{createdUserId}}", + "description": "Id of the user that we want to update" + }, + { + "key": "roleId", + "value": "1", + "description": "Id of the role that you want to update the user with" + } + ] + } + }, + "response": [] + }, + { + "name": "Role-DeleteRole-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "", + "disabled": true + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Search", + "item": [ + { + "name": "Search-SearchInternal-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Search/internal/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Search", + "internal", + "1" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Wizard", + "item": [], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Institution", + "item": [ + { + "name": "Institution-CreateInstitution-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"{{institutionName}}\",\n \"description\": \"postmantest_initial_description\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Institution", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution" + ] + } + }, + "response": [] + }, + { + "name": "Institution-GetInstitution-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Institution/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Institution-UpdateInstitution-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{institutionName}}\",\r\n \"description\": \"postmantest_initial_description\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Institution/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Instituiton-DeleteInstitution-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Institution/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution", + "1" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "File", + "item": [ + { + "name": "Post-File-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 401\", function () {\r", + " pm.response.to.have.status(401);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.unauthorized;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "Postman/testimage.png" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Get-Files-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 401\", function () {\r", + " pm.response.to.have.status(401);\r", + "});\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "File-Delete-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 401\", function () {\r", + " pm.response.to.have.status(401);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.unauthorized;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/File/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File", + "1" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "CallToActionOption", + "item": [ + { + "name": "CallToActionOption-CreateCallToActionOption-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"type\": \"Title\",\n \"value\": \"Provide feedback\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-GetAllCallToActionOptions-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-GetCallToActionOptionById-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-GetCallToActionOptionByType-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/type/{{callToActionOptionType}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "type", + "{{callToActionOptionType}}" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-UpdateCallToActionOption-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n\t\"type\": \"Updated type\",\r\n \"value\": \"Updated value\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-DeleteCallToActionOption-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Cleanup Administrator", + "item": [ + { + "name": "CallToActionOption-DeleteCallToActionOption-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{adminProjectId}}" + ] + } + }, + "response": [] + } + ] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Registered", + "item": [ + { + "name": "Preparation", + "item": [ + { + "name": "User-CreateUser", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var userName = pm.environment.get(\"userName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdUserId\", jsonData.id);", + "pm.environment.set(\"identityId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"9996\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_Registered_User-CreateUser@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "Project-CreateProject", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", + "var projectName = pm.environment.get(\"projectName\");", + "var adminUserName = pm.environment.get(\"adminUserName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"projectId\", jsonData.id);", + "pm.environment.set(\"adminProjectId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", + " pm.expect(jsonData.user.name).to.eql(adminUserName);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", + " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_Registered-Project-CreateProject\",\r\n \"shortDescription\": \"postmantest_Registered-Project-CreateProject\",\r\n \"uri\": \"postmantest_Registered-Project-CreateProject\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Registered-Project-CreateProject\",\r\n \"role\": \"postmantest_Registered-Project-CreateProject\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-CreateHighlight", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postman_Registered_Highlight-CreateHighlight\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Embed-CreateEmbed", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"embedGuid\", jsonData.guid);", + "pm.environment.set(\"adminEmbedGuid\", jsonData.guid);", + "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-CreateCallToActionOption", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"callToActionOptionId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Call to action option type is lowercase\", function () {", + " pm.expect(jsonData.type).to.eql(jsonData.type.toLowerCase());", + "});", + "", + "pm.test(\"Call to action option value is lowercase\", function () {", + " pm.expect(jsonData.value).to.eql(jsonData.value.toLowerCase());", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"type\": \"Title\",\r\n \"value\": \"Feedback\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption" + ] + } + }, + "response": [] + } + ], + "description": "For some requests, we need to have data available. The variables need to be filled so the request can succeed. We put these preparation requests in this folder. We will clean them up in the cleanup folder.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "User", + "item": [ + { + "name": "User-CreateUser-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-GetUser-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-GetUser-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var aliceIdentityId = parseInt(pm.environment.get(\"registeredUserIdentityId\"));", + "", + "var jsonData = pm.response.json();", + "pm.environment.set(\"registeredUserId\", jsonData.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + aliceIdentityId, function () {", + " pm.expect(parseInt(jsonData.identityId)).to.eql(aliceIdentityId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-UpdateUser-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if email update matches: \" + updatedAliceEmail, function () {", + " pm.expect(jsonData.email).to.eql(updatedAliceEmail);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"postman_User-UpdateUser-Self-Registered_alicez\",\r\n \"email\": \"{{updatedAliceEmail}}\",\r\n \"identityId\": \"{{registeredUserIdentityId}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/{{registeredUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{registeredUserId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UpdateUser-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-DeleteUser-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + } + ], + "description": "Requests executed as the Alice user with the registered role.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "FollowUser", + "item": [ + { + "name": "User-FollowUser-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "var userId = pm.environment.get(\"userIdToFollow\");", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userId, function () {", + " pm.expect(jsonData.id).to.eql(userId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UnFollowUser-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Project", + "item": [ + { + "name": "Project-CreateProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var registeredUserId = pm.environment.get(\"registeredUserId\");", + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "pm.environment.set(\"projectId\", jsonData.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"Identity Id is set correctly and matches: \" + registeredUserId, function () {", + " pm.expect(jsonData.user.id).to.eql(registeredUserId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_Project-CreateProject-Registered\",\r\n \"shortDescription\": \"postmantest_Project-CreateProject-Registered\",\r\n \"uri\": \"postmantest_Project-CreateProject-Registered\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Project-CreateProject-Registered\",\r\n \"role\": \"postmantest_Project-CreateProject-Registered\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetAllProjects-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findProject(jsonData, name) {", + " for (var i = 0; i < jsonData.results.length; i++) {", + " if (jsonData.results[i].name == name) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project: \" + projectName + \" is in list\", function () {", + " foundAt = findProject(jsonData, projectName);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetProject-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetProject-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{adminProjectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UpdateProject-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectName = pm.environment.get(\"projectNameUpdated\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_Project-CreateProject-Registered\",\r\n \"shortDescription\": \"postmantest_Project-CreateProject-Registered\",\r\n \"uri\": \"postmantest_Project-CreateProject-Registered\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Project-CreateProject-Registered\",\r\n \"role\": \"postmantest_Project-CreateProject-Registered\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UpdateProject-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{adminProjectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-LikeProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.ok;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "like", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteLikeProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.ok;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "like", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteProject-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectToBeDeletedByUnauthorizedRoles}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectToBeDeletedByUnauthorizedRoles}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "FollowProject", + "item": [ + { + "name": "Project-FollowProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectId = pm.environment.get(\"projectIdToFollow\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if created Username matches: \" + projectId, function () {", + " pm.expect(jsonData.id).to.eql(projectId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UnFollowProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Embed", + "item": [ + { + "name": "Embed-CreateEmbed-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"embedGuid\", jsonData.guid);", + "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-CreateEmbed-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{adminProjectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetAllEmbeds-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetEmbed-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Embed matches: \" + embeddedProjectId, function () {", + " pm.expect(jsonData.id).to.eql(embeddedProjectId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Embed-DeleteEmbed-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Embed-DeleteEmbed-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{adminEmbedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{adminEmbedGuid}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Highlight", + "item": [ + { + "name": "Highlight-CreateHighlight-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetAllActiveHighlights-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectId = pm.environment.get(\"adminProjectId\");", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findItem(jsonData, item) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].projectId == item) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight is in list and matching: \" + projectId, function () {", + " foundAt = findItem(jsonData, projectId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", + "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight Id matches: \" + highlightId, function () {", + " pm.expect(jsonData.id).to.eql(highlightId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-ByProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-UpdateHighlight-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-DeleteHighlight-Other-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Role", + "item": [ + { + "name": "Role-CreateRole-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetAllRoles-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + } + }, + "response": [] + }, + { + "name": "Scope-GetAllScopes-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/Scopes", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "Scopes" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetRole-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + }, + { + "name": "Role-UpdateRole-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + }, + { + "name": "Role-SetRole-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"createdUserId\": {{createdUserId}},\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId={{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "setRole" + ], + "query": [ + { + "key": "createdUserId", + "value": "{{createdUserId}}", + "description": "Id of the user that we want to update" + }, + { + "key": "roleId", + "value": "{{roleId}}", + "description": "Id of the role that you want to update the user with" + } + ] + } + }, + "response": [] + }, + { + "name": "Role-DeleteRole-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Search", + "item": [ + { + "name": "Search-SearchInternal-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Search/internal/{{projectName}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Search", + "internal", + "{{projectName}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Wizard", + "item": [] + }, + { + "name": "Institution", + "item": [ + { + "name": "Institution-CreateInstitution-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "Institution-GetInstitution-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Institution-UpdateInstitution-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Instituiton-DeleteInstitution-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "ProjectIcon", + "item": [ + { + "name": "ProjectIcon-Post-File-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response includes fileId\", function () {\r", + " pm.expect(jsonData.id).to.exist;\r", + "})\r", + "\r", + "pm.environment.set(\"ProjectIconRegisteredFileId\", jsonData.id);\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "Postman/testimage.png" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "ProjectIcon-CreateProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var registeredUserId = pm.environment.get(\"registeredUserId\");", + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "pm.environment.set(\"ProjectIconProjectId\", jsonData.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"shortDescription\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"uri\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"role\": \"postmantest_ProjectIcon-CreateProject-Registered\"\r\n }\r\n ],\r\n \"fileId\": {{ProjectIconRegisteredFileId}},\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "ProjectIcon-GetProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectName = pm.environment.get(\"projectName\");", + "var ProjectIconRegisteredFileId = pm.environment.get(\"ProjectIconRegisteredFileId\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"ProjectIconId is set correctly and matches: \" + ProjectIconRegisteredFileId, function () {", + " pm.expect(jsonData.projectIcon.id).to.eql(ProjectIconRegisteredFileId)", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{ProjectIconProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{ProjectIconProjectId}}" + ] + } + }, + "response": [] + }, + { + "name": "ProjectIcon-GetIcon-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.ok;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/file/{{ProjectIconRegisteredFileId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "file", + "{{ProjectIconRegisteredFileId}}" + ] + } + }, + "response": [] + }, + { + "name": "ProjectIcon-UpdateProject-Same-ProjectIcon", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectName = pm.environment.get(\"projectNameUpdated\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"shortDescription\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"uri\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"role\": \"postmantest_ProjectIcon-CreateProject-Registered\"\r\n }\r\n ],\r\n \"fileId\": {{ProjectIconRegisteredFileId}},\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project/{{ProjectIconProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{ProjectIconProjectId}}" + ] + } + }, + "response": [] + }, + { + "name": "ProjectIcon-GetIcon-Registered-After-Edit", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.ok;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/file/{{ProjectIconRegisteredFileId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "file", + "{{ProjectIconRegisteredFileId}}" + ] + } + }, + "response": [] + }, + { + "name": "ProjectIcon-Post-New-File-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response includes fileId\", function () {\r", + " pm.expect(jsonData.id).to.exist;\r", + "})\r", + "\r", + "pm.environment.set(\"newRegisteredFileId\", jsonData.id);\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "Postman/testimage2.png" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "ProjectIcon-UpdateProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectName = pm.environment.get(\"projectNameUpdated\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"shortDescription\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"uri\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"role\": \"postmantest_ProjectIcon-CreateProject-Registered\"\r\n }\r\n ],\r\n \"fileId\": {{newRegisteredFileId}},\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project/{{ProjectIconProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{ProjectIconProjectId}}" + ] + } + }, + "response": [] + }, + { + "name": "ProjectIcon-GetUpdatedProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectName = pm.environment.get(\"projectName\");", + "var newRegisteredFileId = pm.environment.get(\"newRegisteredFileId\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"ProjectIconId is set correctly and matches: \" + newRegisteredFileId, function () {", + " pm.expect(jsonData.projectIcon.id).to.eql(newRegisteredFileId)", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{ProjectIconProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{ProjectIconProjectId}}" + ] + } + }, + "response": [] + }, + { + "name": "ProjectIcon-GetDeletedIcon-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 404\", function () {\r", + " pm.response.to.have.status(404);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.notFound;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/file/{{ProjectIconRegisteredFileId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "file", + "{{ProjectIconRegisteredFileId}}" + ] + } + }, + "response": [] + }, + { + "name": "ProjectIcon-GetNewIcon-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.ok;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/file/{{newRegisteredFileId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "file", + "{{newRegisteredFileId}}" + ] + } + }, + "response": [] + }, + { + "name": "ProjectIcon-DeleteProject-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{ProjectIconProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{ProjectIconProjectId}}" + ] + } + }, + "response": [] + }, + { + "name": "ProjectIcon-GetNewIcon-Registered Copy", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 404\", function () {\r", + " pm.response.to.have.status(404);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.notFound;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/file/{{ProjectIconRegisteredFileId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "file", + "{{ProjectIconRegisteredFileId}}" + ] + } + }, + "response": [] + } + ], + "description": "Testing if the icons are accessible, and get deleted when they are supposed to ", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "CallToActionOption", + "item": [ + { + "name": "CallToActionOption-CreateCallToActionOption-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"type\": \"Title\",\n \"value\": \"Provide feedback\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-GetAllCallToActionOptions-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var optionId = parseInt(pm.environment.get(\"callToActionOptionId\"));", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findOption(jsonData, id) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].id == id) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Call to action option with id: \" + optionId + \" is in list\", function () {", + " foundAt = findOption(jsonData, optionId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-GetCallToActionOptionById-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"callToActionOptionType\", jsonData.type);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Call to action option type is lowercase\", function () {", + " pm.expect(jsonData.type).to.eql(jsonData.type.toLowerCase());", + "});", + "", + "pm.test(\"Call to action option value is lowercase\", function () {", + " pm.expect(jsonData.value).to.eql(jsonData.value.toLowerCase());", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-GetCallToActionOptionByType-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var callToActionOptionId = parseInt(pm.environment.get(\"callToActionOptionId\"));", + "", + "var jsonData = pm.response.json();", + "", + "function findOptionType(jsonData, id) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].id == id) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Call to action option id is \" + callToActionOptionId, function() {", + " foundAt = findOptionType(jsonData, callToActionOptionId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/type/{{callToActionOptionType}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "type", + "{{callToActionOptionType}}" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-UpdateCallToActionOption-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n\t\"type\": \"Updated type\",\r\n \"value\": \"Updated value\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-DeleteCallToActionOption-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "File", + "item": [ + { + "name": "Get-Files-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Post-File-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "pm.environment.set(\"registeredFileId\", jsonData.id)\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "Postman/testimage.png" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Delete-File-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid\", function () {\r", + " pm.response.to.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{registeredUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File/{{registeredFileId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File", + "{{registeredFileId}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Cleanup Registered", + "item": [ + { + "name": "Project-DeleteProject-Self-Registered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{registeredUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Cleanup Administrator", + "item": [ + { + "name": "CallToActionOption-DeleteCallToActionOption-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{adminProjectId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-DeleteUser-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + } + ] + }, + { + "name": "Data Officer", + "item": [ + { + "name": "Preparation", + "item": [ + { + "name": "Institution-CreateInstitution", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var institutionName = pm.environment.get(\"institutionName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdInstitutionId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Name matches: \" + institutionName, function () {", + " pm.expect(jsonData.name).to.eql(institutionName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"{{institutionName}}\",\n \"description\": \"postmantest_DataOfficer-Institution-CreateInstitution\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Institution", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution" + ] + } + }, + "response": [] + }, + { + "name": "User-CreateUserWithoutInstitution", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var userName = pm.environment.get(\"userName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdUserId\", jsonData.id);", + "pm.environment.set(\"identityId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"9996\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_DataOfficer-User-CreateUserWithoutInstitution@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-CreateUserWithInstitution", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var userName = pm.environment.get(\"userName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdUserWithInstitutionId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"9996\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_DataOfficer-User-CreateUserWithInstitution@example.com\",\n \"institutionId\": {{institutionIdFromUser}}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "Project-CreateProject-DifferentInstitution", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", + "var projectName = pm.environment.get(\"projectName\");", + "var adminUserName = pm.environment.get(\"adminUserName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"projectId\", jsonData.id);", + "pm.environment.set(\"adminProjectId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", + " pm.expect(jsonData.user.name).to.eql(adminUserName);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", + " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_DataOfficer-Project-CreateProject-DifferentInstitution\",\r\n \"shortDescription\": \"postmantest_DataOfficer-Project-CreateProject-DifferentInstitution\",\r\n \"uri\": \"postmantest_DataOfficer-Project-CreateProject-DifferentInstitution\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_DataOfficer-Project-CreateProject-DifferentInstitution\",\r\n \"role\": \"postmantest_DataOfficer-Project-CreateProject-DifferentInstitution\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-CreateProject-SameInstitution", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"projectIdWithInstitution\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "\"9996\"" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_DataOfficer-Project-CreateProject-SameInstitution\",\r\n \"shortDescription\": \"postmantest_DataOfficer-Project-CreateProject-SameInstitution\",\r\n \"uri\": \"postmantest_DataOfficer-Project-CreateProject-SameInstitution\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_DataOfficer-Project-CreateProject-SameInstitution\",\r\n \"role\": \"postmantest_DataOfficer-Project-CreateProject-SameInstitution\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-CreateHighlight", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postmantest_DataOfficer-Highlight-CreateHighlight\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Embed-CreateEmbed-DifferentInstitution", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"embedGuid\", jsonData.guid);", + "pm.environment.set(\"adminEmbedGuid\", jsonData.guid);", + "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-CreateEmbed-SameInstitution", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"embedGuidWithInstitution\", jsonData.guid);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "\"9996\"" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectIdWithInstitution}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-CreateCallToActionOption", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"callToActionOptionId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Call to action option type is lowercase\", function () {", + " pm.expect(jsonData.type).to.eql(jsonData.type.toLowerCase());", + "});", + "", + "pm.test(\"Call to action option value is lowercase\", function () {", + " pm.expect(jsonData.value).to.eql(jsonData.value.toLowerCase());", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"type\": \"Title\",\r\n \"value\": \"Feedback\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption" + ] + } + }, + "response": [] + } + ], + "description": "For some requests, we need to have data available. The variables need to be filled so the request can succeed. We put these preparation requests in this folder. We will clean them up in the cleanup folder.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "User", + "item": [ + { + "name": "User-CreateUser-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\",\n \"institutionId\": {{createdInstitutionId}}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-UpdateUser-SelfWithSameInstitution-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if email update matches: \" + updatedAliceEmail, function () {", + " pm.expect(jsonData.email).to.eql(updatedAliceEmail);", + "});", + "", + "pm.test(\"Check if institution id is 1\", function () {", + " pm.expect(jsonData.institution.id).to.equal(1);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"postman_DataOfficer-alicez\",\r\n \"email\": \"{{updatedAliceEmail}}\",\r\n \"identityId\": \"{{dataOfficerUserIdentityId}}\",\r\n \"institutionId\": 1\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/{{dataOfficerUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{dataOfficerUserId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UpdateUser-SelfWithWrongInstitution-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Instance guid should be: DD72C521-1D06-4E11-A0E0-AAE515E7F900\", function () {", + " pm.expect(jsonData.instance).to.equal(\"DD72C521-1D06-4E11-A0E0-AAE515E7F900\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"postman_DataOfficer-alicez\",\r\n \"email\": \"{{updatedAliceEmail}}\",\r\n \"identityId\": \"{{dataOfficerUserIdentityId}}\",\r\n \"institutionId\": {{createdInstitutionId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/{{dataOfficerUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{dataOfficerUserId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UpdateUser-OtherWithSameInstitution-SameInstitutionId-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "var institutionId = pm.environment.get(\"institutionIdFromUser\");", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Institution Id is \" + institutionId, function() {", + " pm.expect(jsonData.institution.id).to.equal(parseInt(institutionId));", + "})" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"institutionId\": {{institutionIdFromUser}},\r\n \"identityId\": \"9996\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserWithInstitutionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserWithInstitutionId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-GetUser-Other-SameInstitution-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserWithInstitutionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserWithInstitutionId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UpdateUser-OtherWithSameInstitution-NoInstitutionId-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if institution is null\", function () {", + " pm.expect(jsonData.institution).to.equal(null);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": \"9996\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserWithInstitutionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserWithInstitutionId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UpdateUser-Other-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": \"9996\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserWithInstitutionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserWithInstitutionId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-GetUser-Other-DifferentInstitution-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-GetUser-Self-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var aliceIdentityId = parseInt(pm.environment.get(\"dataOfficerUserIdentityId\"));", + "", + "var jsonData = pm.response.json();", + "pm.environment.set(\"dataOfficerUserId\", jsonData.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + aliceIdentityId, function () {", + " pm.expect(parseInt(jsonData.identityId)).to.eql(aliceIdentityId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + } + ], + "description": "Requests executed as the Alice user with the registered role.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Project", + "item": [ + { + "name": "Project-CreateProject-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var registeredUserId = pm.environment.get(\"dataOfficerUserId\");", + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "pm.environment.set(\"projectId\", jsonData.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"Identity Id is set correctly and matches: \" + registeredUserId, function () {", + " pm.expect(jsonData.user.id).to.eql(registeredUserId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_Project-CreateProject-DataOfficer\",\r\n \"shortDescription\": \"postmantest_Project-CreateProject-DataOfficer\",\r\n \"uri\": \"postmantest_Project-CreateProject-DataOfficer\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Project-CreateProject-DataOfficer\",\r\n \"role\": \"postmantest_Project-CreateProject-DataOfficer\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetAllProjects-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findProject(jsonData, name) {", + " for (var i = 0; i < jsonData.results.length; i++) {", + " if (jsonData.results[i].name == name) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project: \" + projectName + \" is in list\", function () {", + " foundAt = findProject(jsonData, projectName);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetProject-Self-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetProject-Other-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{adminProjectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UpdateProject-Self-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectName = pm.environment.get(\"projectNameUpdated\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_Project-UpdateProject-Self-DataOfficer\",\r\n \"shortDescription\": \"postmantest_Project-UpdateProject-Self-DataOfficer\",\r\n \"uri\": \"postmantest_Project-UpdateProject-Self-DataOfficer\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Project-UpdateProject-Self-DataOfficer\",\r\n \"role\": \"postmantest_Project-UpdateProject-Self-DataOfficer\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UpdateProject-Other-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{adminProjectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-LikeProject-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.ok;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "like", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteLikeProject-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.ok;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "like", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteProject-Other-OtherInstitution-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectToBeDeletedByUnauthorizedRoles}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectToBeDeletedByUnauthorizedRoles}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Embed", + "item": [ + { + "name": "Embed-CreateEmbed-Self-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"embedGuid\", jsonData.guid);", + "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-CreateEmbed-Other-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{adminProjectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetAllEmbeds-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetEmbed-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Embed matches: \" + embeddedProjectId, function () {", + " pm.expect(jsonData.id).to.eql(embeddedProjectId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Embed-DeleteEmbed-Self-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Embed-DeleteEmbed-Other-DifferentInstitution-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{adminEmbedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{adminEmbedGuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Embed-DeleteEmbed-Other-SameInstitution-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuidWithInstitution}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuidWithInstitution}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Highlight", + "item": [ + { + "name": "Highlight-CreateHighlight-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetAllActiveHighlights-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectId = pm.environment.get(\"adminProjectId\");", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findItem(jsonData, item) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].projectId == item) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight is in list and matching: \" + projectId, function () {", + " foundAt = findItem(jsonData, projectId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", + "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight Id matches: \" + highlightId, function () {", + " pm.expect(jsonData.id).to.eql(highlightId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-ByProject-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-UpdateHighlight-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "value": "{{dataOfficerUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-DeleteHighlight-Other-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Role", + "item": [ + { + "name": "Role-CreateRole-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetAllRoles-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + } + }, + "response": [] + }, + { + "name": "Scope-GetAllScopes-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/Scopes", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "Scopes" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetRole-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + }, + { + "name": "Role-UpdateRole-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + }, + { + "name": "Role-SetRole-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"createdUserId\": {{createdUserId}},\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId={{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "setRole" + ], + "query": [ + { + "key": "createdUserId", + "value": "{{createdUserId}}", + "description": "Id of the user that we want to update" + }, + { + "key": "roleId", + "value": "{{roleId}}", + "description": "Id of the role that you want to update the user with" + } + ] + } + }, + "response": [] + }, + { + "name": "Role-DeleteRole-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Search", + "item": [ + { + "name": "Search-SearchInternal-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Search/internal/{{projectName}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Search", + "internal", + "{{projectName}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Wizard", + "item": [] + }, + { + "name": "Institution", + "item": [ + { + "name": "Institution-CreateInstitution-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "Institution-GetInstitution-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Institution-UpdateInstitution-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Instituiton-DeleteInstitution-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "CallToActionOption", + "item": [ + { + "name": "CallToActionOption-CreateCallToActionOption-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{dataOfficerUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"type\": \"Title\",\n \"value\": \"Provide feedback\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-GetAllCallToActionOptions-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var optionId = parseInt(pm.environment.get(\"callToActionOptionId\"));", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findOption(jsonData, id) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].id == id) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Call to action option with id: \" + optionId + \" is in list\", function () {", + " foundAt = findOption(jsonData, optionId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-GetCallToActionOptionById-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"callToActionOptionType\", jsonData.type);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Call to action option type is lowercase\", function () {", + " pm.expect(jsonData.type).to.eql(jsonData.type.toLowerCase());", + "});", + "", + "pm.test(\"Call to action option value is lowercase\", function () {", + " pm.expect(jsonData.value).to.eql(jsonData.value.toLowerCase());", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{dataOfficerUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-GetCallToActionOptionByType-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var callToActionOptionId = parseInt(pm.environment.get(\"callToActionOptionId\"));", + "", + "var jsonData = pm.response.json();", + "", + "function findOptionType(jsonData, id) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].id == id) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Call to action option id is \" + callToActionOptionId, function() {", + " foundAt = findOptionType(jsonData, callToActionOptionId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/type/{{callToActionOptionType}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "type", + "{{callToActionOptionType}}" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-UpdateCallToActionOption-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "value": "{{dataOfficerUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n\t\"type\": \"Updated type\",\r\n \"value\": \"Updated value\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-DeleteCallToActionOption-DataOffficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{dataOfficerUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "File", + "item": [ + { + "name": "Post-File-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "pm.environment.set(\"dataOfficerFileId\", jsonData.id)\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{dataOfficerUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "Postman/testimage.png" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Get-Files-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{dataOfficerUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Delete-File-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid\", function () {\r", + " pm.response.to.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File/{{dataOfficerFileId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File", + "{{dataOfficerFileId}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Cleanup Data Officer", + "item": [ + { + "name": "Project-DeleteProject-Self-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteProject-Other-SameInstitution-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectIdWithInstitution}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectIdWithInstitution}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UpdateUser-SelfWithNoInstitution-DataOfficer", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if email update matches: \" + updatedAliceEmail, function () {", + " pm.expect(jsonData.email).to.eql(updatedAliceEmail);", + "});", + "", + "pm.test(\"Check if institution is null\", function () {", + " pm.expect(jsonData.institution).to.equal(null);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{dataOfficerUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"postman_DataOfficer-alicez\",\r\n \"email\": \"{{updatedAliceEmail}}\",\r\n \"identityId\": \"{{dataOfficerUserIdentityId}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/{{dataOfficerUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{dataOfficerUserId}}" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Cleanup Administrator", + "item": [ + { + "name": "CallToActionOption-DeleteCallToActionOption-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{adminProjectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Institution-DeleteInstitution-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Institution", + "{{createdInstitutionId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-DeleteUser-Other-SameInstitution-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserWithInstitutionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserWithInstitutionId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-DeleteUser-Other-DifferentInstitution-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + } + ] + } + ] + }, + { + "name": "PR", + "item": [ + { + "name": "Preparation", + "item": [ + { + "name": "User-CreateUser", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var userName = pm.environment.get(\"userName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"createdUserId\", jsonData.id);", + "pm.environment.set(\"identityId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"99966\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_PR-User-CreateUser@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "Project-CreateProject", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", + "var projectName = pm.environment.get(\"projectName\");", + "var adminUserName = pm.environment.get(\"adminUserName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"projectId\", jsonData.id);", + "pm.environment.set(\"adminProjectId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", + " pm.expect(jsonData.user.name).to.eql(adminUserName);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", + " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_PR-Project-CreateProject\",\r\n \"shortDescription\": \"postmantest_PR-Project-CreateProject\",\r\n \"uri\": \"postmantest_PR-Project-CreateProject\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_PR-Project-CreateProject\",\r\n \"role\": \"postmantest_PR-Project-CreateProject\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-CreateHighlight", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postmantest_PR-Highlight-CreateHighlight\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Embed-CreateEmbed", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"embedGuid\", jsonData.guid);", + "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-CreateCallToActionOption", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"callToActionOptionId\", jsonData.id);", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Call to action option type is lowercase\", function () {", + " pm.expect(jsonData.type).to.eql(jsonData.type.toLowerCase());", + "});", + "", + "pm.test(\"Call to action option value is lowercase\", function () {", + " pm.expect(jsonData.value).to.eql(jsonData.value.toLowerCase());", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"type\": \"Title\",\r\n \"value\": \"Feedback\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption" + ] + } + }, + "response": [] + } + ], + "description": "For some requests, we need to have data available. The variables need to be filled so the request can succeed. We put these preparation requests in this folder. We will clean them up in the cleanup folder.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "User", + "item": [ + { + "name": "User-CreateUser-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-GetUser-Other-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-GetUser-Self-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var prUserIdentityId = parseInt(pm.environment.get(\"prUserIdentityId\"));", + "", + "var jsonData = pm.response.json();", + "pm.environment.set(\"PrUserId\", jsonData.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + prUserIdentityId, function () {", + " pm.expect(parseInt(jsonData.identityId)).to.eql(prUserIdentityId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "User-UpdateUser-Self-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var updatedPrUserEmail = pm.environment.get(\"updatedPrUserEmail\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if email update matches: \" + updatedPrUserEmail, function () {", + " pm.expect(jsonData.email).to.eql(updatedPrUserEmail);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"postman_Pr_jerry\",\r\n \"email\": \"{{updatedPrUserEmail}}\",\r\n \"identityId\": \"{{prUserIdentityId}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/{{PrUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{PrUserId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UpdateUser-Other-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + } + ], + "description": "Requests executed as the Alice user with the registered role.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "FollowUser", + "item": [ + { + "name": "User-FollowUser-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "var userId = pm.environment.get(\"userIdToFollow\");", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userId, function () {", + " pm.expect(jsonData.id).to.eql(userId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "User-UnFollowUser-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "follow", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Project", + "item": [ + { + "name": "Project-CreateProject-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var PrUserId = pm.environment.get(\"PrUserId\");", + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "pm.environment.set(\"projectId\", jsonData.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"User Id is set correctly and matches: \" + PrUserId, function () {", + " pm.expect(jsonData.user.id).to.eql(PrUserId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_Project-CreateProject-PR\",\r\n \"shortDescription\": \"postmantest_Project-CreateProject-PR\",\r\n \"uri\": \"postmantest_Project-CreateProject-PR\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Project-CreateProject-PR\",\r\n \"role\": \"postmantest_Project-CreateProject-PR\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetAllProjects-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findProject(jsonData, name) {", + " for (var i = 0; i < jsonData.results.length; i++) {", + " if (jsonData.results[i].name == name) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project: \" + projectName + \" is in list\", function () {", + " foundAt = findProject(jsonData, projectName);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetProject-Self-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectName = pm.environment.get(\"projectName\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-GetProject-Other-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{adminProjectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UpdateProject-Self-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectName = pm.environment.get(\"projectNameUpdated\");", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_Project-CreateProject-PR\",\r\n \"shortDescription\": \"postmantest_Project-CreateProject-PR\",\r\n \"uri\": \"postmantest_Project-CreateProject-PR\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Project-CreateProject-PR\",\r\n \"role\": \"postmantest_Project-CreateProject-PR\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UpdateProject-Other-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{adminProjectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-LikeProject-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.ok;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "like", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteLikeProject-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.ok;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "like", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteProject-Other-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{adminProjectId}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "FollowProject", + "item": [ + { + "name": "Project-FollowProject-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "var projectId = pm.environment.get(\"projectIdToFollow\");", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if created project id matches: \" + projectId, function () {", + " pm.expect(jsonData.id).to.eql(projectId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-UnFollowProject-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "project", + "follow", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Embed", + "item": [ + { + "name": "Embed-CreateEmbed-Self-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"embedGuid\", jsonData.guid);", + "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-CreateEmbed-Other-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"otherEmbedGuid\", jsonData.guid);", + "pm.environment.set(\"otherEmbeddedProjectId\", jsonData.project.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{adminProjectId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetAllEmbeds-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetEmbed-Self-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Embed matches: \" + embeddedProjectId, function () {", + " pm.expect(jsonData.id).to.eql(embeddedProjectId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Embed-GetEmbed-Other-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var otherEmbeddedProjectId = parseInt(pm.environment.get(\"otherEmbeddedProjectId\"))", + "", + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Embed matches: \" + otherEmbeddedProjectId, function () {", + " pm.expect(jsonData.id).to.eql(otherEmbeddedProjectId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{otherEmbedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{otherEmbedGuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Embed-DeleteEmbed-Self-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{embedGuid}}" + ] + } + }, + "response": [] + }, + { + "name": "Embed-DeleteEmbed-Other-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Embed/{{otherEmbedGuid}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Embed", + "{{otherEmbedGuid}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Highlight", + "item": [ + { + "name": "Highlight-CreateHighlight-Self-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightId\", jsonData.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postman_Highlight-CreateHighlight-Self-PR\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-Self-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", + "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight Id matches: \" + highlightId, function () {", + " pm.expect(jsonData.id).to.eql(highlightId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-ByProject-Self-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "var projectId = parseInt(pm.environment.get(\"projectId\"));", + "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findHighlightId(jsonData, item) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].id == item) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "function findProjectId(jsonData, item) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].projectId == item) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project is in list and matching: \" + projectId, function () {", + " foundAt = findProjectId(jsonData, projectId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "", + "pm.test(\"Highlight is in list and matching:\" + highlightId, function () {", + " foundAt = findHighlightId(jsonData, highlightId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-UpdateHighlight-Self-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postman_Highlight-CreateHighlight-Self-PR\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-CreateHighlight-Other-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "pm.environment.set(\"adminHighlightId\", jsonData.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", + "\r", + "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", + "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": {{adminProjectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postman_Highlight-CreateHighlight-Other-PR\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-Other-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "var adminHighlightId = parseInt(pm.environment.get(\"adminHighlightId\"));", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", + "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight Id matches: \" + adminHighlightId, function () {", + " pm.expect(jsonData.id).to.eql(adminHighlightId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{adminHighlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{adminHighlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetHighlight-ByProject-Other-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var identityId = parseInt(pm.environment.get(\"identityId\"));", + "var adminProjectId = parseInt(pm.environment.get(\"adminProjectId\"));", + "var adminHighlightId = parseInt(pm.environment.get(\"adminHighlightId\"));", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findHighlightId(jsonData, item) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].id == item) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "function findProjectId(jsonData, item) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].projectId == item) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project is in list and matching: \" + adminProjectId, function () {", + " foundAt = findProjectId(jsonData, adminProjectId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "", + "pm.test(\"Highlight is in list and matching:\" + adminHighlightId, function () {", + " foundAt = findHighlightId(jsonData, adminHighlightId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/Project/{{adminProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "Project", + "{{adminProjectId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-UpdateHighlight-Other-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var current_timestamp = new Date();\r", + "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postman_Highlight-CreateHighlight-Other-PR\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{adminHighlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{adminHighlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-GetAllActiveHighlights-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var projectId = pm.environment.get(\"adminProjectId\");", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findItem(jsonData, item) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].projectId == item) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Highlight is in list and matching: \" + projectId, function () {", + " foundAt = findItem(jsonData, projectId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-DeleteHighlight-Self-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{highlightId}}" + ] + } + }, + "response": [] + }, + { + "name": "Highlight-DeleteHighlight-Other-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Highlight/{{adminHighlightId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Highlight", + "{{adminHighlightId}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Role", + "item": [ + { + "name": "Role-CreateRole-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetAllRoles-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role" + ] + } + }, + "response": [] + }, + { + "name": "Scope-GetAllScopes-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/Scopes", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "Scopes" + ] + } + }, + "response": [] + }, + { + "name": "Role-GetRole-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + }, + { + "name": "Role-UpdateRole-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + }, + { + "name": "Role-SetRole-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"createdUserId\": {{createdUserId}},\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId={{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "setRole" + ], + "query": [ + { + "key": "createdUserId", + "value": "{{createdUserId}}", + "description": "Id of the user that we want to update" + }, + { + "key": "roleId", + "value": "{{roleId}}", + "description": "Id of the role that you want to update the user with" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Search", + "item": [ + { + "name": "Search-SearchInternal-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Search/internal/{{projectName}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Search", + "internal", + "{{projectName}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Wizard", + "item": [] + }, + { + "name": "Institution", + "item": [ + { + "name": "Institution-CreateInstitution-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "Institution-GetInstitution-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Institution-UpdateInstitution-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + }, + { + "name": "Instituiton-DeleteInstitution-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 401\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.unauthorized;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/User/1", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "1" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "noauth" + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "CallToActionOption", + "item": [ + { + "name": "CallToActionOption-CreateCallToActionOption-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"type\": \"Title\",\n \"value\": \"Provide feedback\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-GetAllCallToActionOptions-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var optionId = parseInt(pm.environment.get(\"callToActionOptionId\"));", + "", + "var jsonData = pm.response.json();", + "", + "var foundAt;", + "", + "function findOption(jsonData, id) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].id == id) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Call to action option with id: \" + optionId + \" is in list\", function () {", + " foundAt = findOption(jsonData, optionId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-GetCallToActionOptionById-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"callToActionOptionType\", jsonData.type);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Call to action option type is lowercase\", function () {", + " pm.expect(jsonData.type).to.eql(jsonData.type.toLowerCase());", + "});", + "", + "pm.test(\"Call to action option value is lowercase\", function () {", + " pm.expect(jsonData.value).to.eql(jsonData.value.toLowerCase());", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-GetCallToActionOptionByType-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var callToActionOptionId = parseInt(pm.environment.get(\"callToActionOptionId\"));", + "", + "var jsonData = pm.response.json();", + "", + "function findOptionType(jsonData, id) {", + " for (var i = 0; i < jsonData.length; i++) {", + " if (jsonData[i].id == id) {", + " return i;", + " }", + " }", + " return -1;", + "}", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Call to action option id is \" + callToActionOptionId, function() {", + " foundAt = findOptionType(jsonData, callToActionOptionId);", + " pm.expect(foundAt).to.not.eql(-1);", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/type/{{callToActionOptionType}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "type", + "{{callToActionOptionType}}" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-UpdateCallToActionOption-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n\t\"type\": \"Updated type\",\r\n \"value\": \"Updated value\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + }, + { + "name": "CallToActionOption-DeleteCallToActionOption-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 403\", function () {", + " pm.response.to.have.status(403);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.forbidden;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "File", + "item": [ + { + "name": "Post-File-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "pm.environment.set(\"prFileId\", jsonData.id)\r", + "\r", + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.success;\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "File", + "type": "file", + "src": "Postman/testimage.png" + } + ] + }, + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Get-Files-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid and have a json body\", function () {\r", + " pm.response.to.be.withBody;\r", + " pm.response.to.be.json;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File" + ] + } + }, + "response": [] + }, + { + "name": "Delete-File-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "eval(pm.environment.get(\"commonTests\"))();\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response must be valid\", function () {\r", + " pm.response.to.be.ok;\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{prUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/File/{{prFileId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "File", + "{{prFileId}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Cleanup PR", + "item": [ + { + "name": "Project-DeleteProject-PR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{prUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectId}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Cleanup Administrator", + "item": [ + { + "name": "CallToActionOption-DeleteCallToActionOption-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "CallToActionOption", + "{{callToActionOptionId}}" + ] + } + }, + "response": [] + }, + { + "name": "Project-DeleteProject-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{adminProjectId}}" + ] + } + }, + "response": [] + }, + { + "name": "User-DeleteUser-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{createdUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{createdUserId}}" + ] + } + }, + "response": [] + } + ] + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/Postman/dex-cleanup.postman_collection.json b/Postman/dex-cleanup.postman_collection.json new file mode 100644 index 00000000..e0aa023c --- /dev/null +++ b/Postman/dex-cleanup.postman_collection.json @@ -0,0 +1,391 @@ +{ + "info": { + "_postman_id": "dff4ba06-7393-4f76-831c-2c57b0971548", + "name": "DEV-Cleanup", + "description": "Testing Digital Excellence API", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Cleanup", + "item": [ + { + "name": "DeleteUsers", + "item": [ + { + "name": "Registered", + "item": [ + { + "name": "Delete-RegisteredUser", + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User/{{registeredUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{registeredUserId}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "PR", + "item": [ + { + "name": "Delete-PRUser", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{prUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{prUserId}}" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "DataOfficer", + "item": [ + { + "name": "Delete-DataOfficerUser", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{dataOfficerUserId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{dataOfficerUserId}}" + ] + } + }, + "response": [] + } + ] + } + ] + }, + { + "name": "Delete-ProjectForFollowing", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "Delete-ProjectToBeDeletedByUnauthorizedRole", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Project/{{projectToBeDeletedByUnauthorizedRoles}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project", + "{{projectToBeDeletedByUnauthorizedRoles}}" + ] + } + }, + "response": [] + }, + { + "name": "Delete-UserForFollowing", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/User/{{userIdToFollow}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User", + "{{userIdToFollow}}" + ] + } + }, + "response": [] + }, + { + "name": "Role-DeleteRole-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/{{roleId}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "{{roleId}}" + ] + } + }, + "response": [] + } + ] + } + ], + "auth": { + "type": "oauth2", + "oauth2": [ + { + "key": "accessToken", + "value": "{{accessToken}}", + "type": "string" + }, + { + "key": "tokenType", + "value": "Bearer", + "type": "string" + }, + { + "key": "addTokenTo", + "value": "header", + "type": "string" + } + ] + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "// Adapted from: https://gist.github.com/harryi3t/dd5c61451206047db70710ff6174c3c1", + "", + "let tokenUrl = pm.variables.get(\"tokenUrl\");", + "let clientId = pm.variables.get(\"clientId\");", + "let clientSecret = pm.variables.get(\"clientSecret\");", + "let scope = pm.variables.get(\"scope\");", + "", + "let getTokenRequest = {", + " method: 'POST',", + " url: tokenUrl,", + " auth: {", + " type: \"basic\",", + " basic: [", + " { key: \"username\", value: clientId },", + " { key: \"password\", value: clientSecret }", + " ]", + " },", + " body: {", + " mode: 'formdata',", + " formdata: [", + " { key: 'grant_type', value: 'client_credentials' },", + " { key: 'scope', value: scope }", + " ]", + " }", + "};", + "", + "pm.sendRequest(getTokenRequest, (err, response) => {", + " let jsonResponse = response.json(),", + " newAccessToken = jsonResponse.access_token;", + "", + " console.log({ err, jsonResponse, newAccessToken })", + "", + " pm.environment.set('accessToken', newAccessToken);", + " pm.variables.set('accessToken', newAccessToken);", + "});" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] +} \ No newline at end of file From c24d62703e2f43e65621be62cddf880264a2a28c Mon Sep 17 00:00:00 2001 From: "Nicole Bours(Desktop)" Date: Fri, 5 Mar 2021 10:43:43 +0100 Subject: [PATCH 02/19] global + warmup collections --- Postman/dex-global.postman_collection.json | 64 +++ Postman/dex-warmup.postman_collection.json | 522 +++++++++++++++++++++ 2 files changed, 586 insertions(+) create mode 100644 Postman/dex-global.postman_collection.json create mode 100644 Postman/dex-warmup.postman_collection.json diff --git a/Postman/dex-global.postman_collection.json b/Postman/dex-global.postman_collection.json new file mode 100644 index 00000000..c060a86f --- /dev/null +++ b/Postman/dex-global.postman_collection.json @@ -0,0 +1,64 @@ +{ + "info": { + "_postman_id": "8e131e7a-dfa9-41ed-a7b2-86f832df00cd", + "name": "DEV-Global", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Global", + "item": [ + { + "name": "Global-AverageTime", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var avgResponseTime = postman.getGlobalVariable(\"response_average\");\r", + "var responseTimeThreshold = pm.environment.get(\"responseTimeThreshold\");\r", + "\r", + "pm.test(\"Average response time: \" + avgResponseTime + \" is lower than \" + responseTimeThreshold + \"ms\", function () {\r", + " pm.expect(avgResponseTime <= responseTimeThreshold);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}", + "host": [ + "{{apiUrl}}" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + } + ] +} \ No newline at end of file diff --git a/Postman/dex-warmup.postman_collection.json b/Postman/dex-warmup.postman_collection.json new file mode 100644 index 00000000..266a0b4a --- /dev/null +++ b/Postman/dex-warmup.postman_collection.json @@ -0,0 +1,522 @@ +{ + "info": { + "_postman_id": "bde1b5a0-b040-4d63-bb82-1bae08860d0c", + "name": "DEV-warmup", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Warmup", + "item": [ + { + "name": "CreateUsers", + "item": [ + { + "name": "Registered", + "item": [ + { + "name": "Create-RegisteredUser", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "pm.environment.set(\"registeredUserId\", jsonData.id)" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + }, + { + "key": "Authorization", + "value": "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImU4VW1OX2NmZlBoamVPQ3hCSkZpb2ciLCJ0eXAiOiJhdCtqd3QifQ.eyJuYmYiOjE2MDgyMDE4MTMsImV4cCI6MTYwODIwNTQxMywiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6NTAwNSIsImF1ZCI6ImRleC1hcGkiLCJjbGllbnRfaWQiOiJkZXgtYXBpLWNsaWVudCIsImNsaWVudF9yb2xlIjoiQmFja2VuZEFwcGxpY2F0aW9uIiwic2NvcGUiOlsiRW1iZWRSZWFkIiwiRW1iZWRXcml0ZSIsIkhpZ2hsaWdodFJlYWQiLCJIaWdobGlnaHRXcml0ZSIsIlByb2plY3RSZWFkIiwiUHJvamVjdFdyaXRlIiwiVXNlclJlYWQiLCJVc2VyV3JpdGUiXX0.jT1Edm1dzKAu47xBFWg4IEWXoIYKTS5lScCmE798FfNdzRutVXlPmMZtac_PcmEcHrbgMvKUqd97UhpnT1ywhToXTQOVcy2EeWfprOkSWKxvTYiP1O55a01iWnOvLcs20ucbjPBHxYeq1WL3FoEfs0ahVSB4nDrqX_MYYmkvX2XriUb97fm9Sdk5fCh44q2tVH7ywZYOWmd3ZwqDB_X4GwyGGpOL_WTIQe-NaBeeONXuKcfEbF5_GpUz751nBvtnuB2lBuAeijLakb4SmtUiaxE479yjMoMz5LA6rpiGxz44gq0k-2r9EZNZs92ziop0cKuvExrDXcScJNAI4QuToQ", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n\t\"identityId\": \"{{registeredUserIdentityId}}\",\r\n \"name\": \"Registered Postman User\",\r\n \"email\": \"registeredUser@postman.com\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "PR", + "item": [ + { + "name": "Create-PRUser", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "pm.environment.set(\"prUserId\", jsonData.id)" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n\t\"identityId\": \"{{prUserIdentityId}}\",\r\n \"name\": \"Public Relationship Postman User\",\r\n \"email\": \"PRUser@postman.com\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "Set-PRUser-Role", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/setRole?userId={{prUserId}}&roleId={{prRole}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "setRole" + ], + "query": [ + { + "key": "userId", + "value": "{{prUserId}}" + }, + { + "key": "roleId", + "value": "{{prRole}}" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "DataOfficer", + "item": [ + { + "name": "Create-DataOfficerUser", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "pm.environment.set(\"dataOfficerUserId\", jsonData.id)\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n\t\"identityId\": \"{{dataOfficerUserIdentityId}}\",\r\n \"name\": \"Data Officer Postman User\",\r\n \"email\": \"dataOfficerUser@postman.com\",\r\n \"institutionId\": 1\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "Set-DataOfficerUser-Role", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "url": { + "raw": "{{apiUrl}}/api/Role/setRole?userId={{dataOfficerUserId}}&roleId={{dataOfficerRole}}", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Role", + "setRole" + ], + "query": [ + { + "key": "userId", + "value": "{{dataOfficerUserId}}" + }, + { + "key": "roleId", + "value": "{{dataOfficerRole}}" + } + ] + } + }, + "response": [] + } + ] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Project-GetAllProjects-Guest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\") + 5000);", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.ok;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "Project-CreateProjectToFollow-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", + "var projectName = pm.environment.get(\"projectName\");", + "var adminUserName = pm.environment.get(\"adminUserName\");", + "", + "var jsonData = pm.response.json();", + "", + "pm.environment.set(\"projectIdToFollow\", jsonData.id);", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", + " pm.expect(jsonData.name).to.eql(projectName);", + "});", + "", + "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", + " pm.expect(jsonData.user.name).to.eql(adminUserName);", + "});", + "", + "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", + " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_ProjectToFollow\",\r\n \"shortDescription\": \"postmantest_ProjectToFollow\",\r\n \"uri\": \"postmantest_ProjectToFollow\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_ProjectToFollow\",\r\n \"role\": \"postmantest_ProjectToFollow\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + }, + { + "name": "User-CreateUserToFollow-Administrator", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var userName = pm.environment.get(\"userName\");", + "", + "var jsonData = pm.response.json();", + "pm.environment.set(\"userIdToFollow\", jsonData.id)", + "", + "eval(pm.environment.get(\"commonTests\"))();", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(201);", + "});", + "", + "pm.test(\"Response must be valid and have a json body\", function () {", + " pm.response.to.be.success;", + " pm.response.to.be.withBody;", + " pm.response.to.be.json;", + "});", + "", + "pm.test(\"Check if created Username matches: \" + userName, function () {", + " pm.expect(jsonData.name).to.eql(userName);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "type": "text", + "value": "{{administratorUserIdentityId}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"identityId\": \"999\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_UserToFollow@example.com\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/User", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "User" + ] + } + }, + "response": [] + }, + { + "name": "CreateProjectToBeDeletedByUnauthorizedRoles", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();\r", + "\r", + "pm.environment.set(\"projectToBeDeletedByUnauthorizedRoles\", jsonData.id);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "IdentityId", + "value": "{{administratorUserIdentityId}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_ProjectToBeDeletedByUnauthorizedRoles\",\r\n \"shortDescription\": \"postmantest_ProjectToBeDeletedByUnauthorizedRoles\",\r\n \"uri\": \"postmantest_ProjectToBeDeletedByUnauthorizedRoles\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_ProjectToBeDeletedByUnauthorizedRoles\",\r\n \"role\": \"postmantest_ProjectToBeDeletedByUnauthorizedRoles\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{apiUrl}}/api/Project", + "host": [ + "{{apiUrl}}" + ], + "path": [ + "api", + "Project" + ] + } + }, + "response": [] + } + ], + "description": "Warmup the API to ensure fast response times" + } + ] +} \ No newline at end of file From ec8658bfb0a07751f4686028d1c5eb89d74ace35 Mon Sep 17 00:00:00 2001 From: "Noorden,Andrew A.J.J" Date: Fri, 5 Mar 2021 11:04:57 +0100 Subject: [PATCH 03/19] Revert "global + warmup collections" This reverts commit c24d62703e2f43e65621be62cddf880264a2a28c. --- Postman/dex-global.postman_collection.json | 64 --- Postman/dex-warmup.postman_collection.json | 522 --------------------- 2 files changed, 586 deletions(-) delete mode 100644 Postman/dex-global.postman_collection.json delete mode 100644 Postman/dex-warmup.postman_collection.json diff --git a/Postman/dex-global.postman_collection.json b/Postman/dex-global.postman_collection.json deleted file mode 100644 index c060a86f..00000000 --- a/Postman/dex-global.postman_collection.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "info": { - "_postman_id": "8e131e7a-dfa9-41ed-a7b2-86f832df00cd", - "name": "DEV-Global", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "Global", - "item": [ - { - "name": "Global-AverageTime", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var avgResponseTime = postman.getGlobalVariable(\"response_average\");\r", - "var responseTimeThreshold = pm.environment.get(\"responseTimeThreshold\");\r", - "\r", - "pm.test(\"Average response time: \" + avgResponseTime + \" is lower than \" + responseTimeThreshold + \"ms\", function () {\r", - " pm.expect(avgResponseTime <= responseTimeThreshold);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}", - "host": [ - "{{apiUrl}}" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - } - ] -} \ No newline at end of file diff --git a/Postman/dex-warmup.postman_collection.json b/Postman/dex-warmup.postman_collection.json deleted file mode 100644 index 266a0b4a..00000000 --- a/Postman/dex-warmup.postman_collection.json +++ /dev/null @@ -1,522 +0,0 @@ -{ - "info": { - "_postman_id": "bde1b5a0-b040-4d63-bb82-1bae08860d0c", - "name": "DEV-warmup", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "Warmup", - "item": [ - { - "name": "CreateUsers", - "item": [ - { - "name": "Registered", - "item": [ - { - "name": "Create-RegisteredUser", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "pm.environment.set(\"registeredUserId\", jsonData.id)" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - }, - { - "key": "Authorization", - "value": "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImU4VW1OX2NmZlBoamVPQ3hCSkZpb2ciLCJ0eXAiOiJhdCtqd3QifQ.eyJuYmYiOjE2MDgyMDE4MTMsImV4cCI6MTYwODIwNTQxMywiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6NTAwNSIsImF1ZCI6ImRleC1hcGkiLCJjbGllbnRfaWQiOiJkZXgtYXBpLWNsaWVudCIsImNsaWVudF9yb2xlIjoiQmFja2VuZEFwcGxpY2F0aW9uIiwic2NvcGUiOlsiRW1iZWRSZWFkIiwiRW1iZWRXcml0ZSIsIkhpZ2hsaWdodFJlYWQiLCJIaWdobGlnaHRXcml0ZSIsIlByb2plY3RSZWFkIiwiUHJvamVjdFdyaXRlIiwiVXNlclJlYWQiLCJVc2VyV3JpdGUiXX0.jT1Edm1dzKAu47xBFWg4IEWXoIYKTS5lScCmE798FfNdzRutVXlPmMZtac_PcmEcHrbgMvKUqd97UhpnT1ywhToXTQOVcy2EeWfprOkSWKxvTYiP1O55a01iWnOvLcs20ucbjPBHxYeq1WL3FoEfs0ahVSB4nDrqX_MYYmkvX2XriUb97fm9Sdk5fCh44q2tVH7ywZYOWmd3ZwqDB_X4GwyGGpOL_WTIQe-NaBeeONXuKcfEbF5_GpUz751nBvtnuB2lBuAeijLakb4SmtUiaxE479yjMoMz5LA6rpiGxz44gq0k-2r9EZNZs92ziop0cKuvExrDXcScJNAI4QuToQ", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"identityId\": \"{{registeredUserIdentityId}}\",\r\n \"name\": \"Registered Postman User\",\r\n \"email\": \"registeredUser@postman.com\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "PR", - "item": [ - { - "name": "Create-PRUser", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "pm.environment.set(\"prUserId\", jsonData.id)" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"identityId\": \"{{prUserIdentityId}}\",\r\n \"name\": \"Public Relationship Postman User\",\r\n \"email\": \"PRUser@postman.com\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - }, - { - "name": "Set-PRUser-Role", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role/setRole?userId={{prUserId}}&roleId={{prRole}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "setRole" - ], - "query": [ - { - "key": "userId", - "value": "{{prUserId}}" - }, - { - "key": "roleId", - "value": "{{prRole}}" - } - ] - } - }, - "response": [] - } - ] - }, - { - "name": "DataOfficer", - "item": [ - { - "name": "Create-DataOfficerUser", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "pm.environment.set(\"dataOfficerUserId\", jsonData.id)\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"identityId\": \"{{dataOfficerUserIdentityId}}\",\r\n \"name\": \"Data Officer Postman User\",\r\n \"email\": \"dataOfficerUser@postman.com\",\r\n \"institutionId\": 1\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - }, - { - "name": "Set-DataOfficerUser-Role", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role/setRole?userId={{dataOfficerUserId}}&roleId={{dataOfficerRole}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "setRole" - ], - "query": [ - { - "key": "userId", - "value": "{{dataOfficerUserId}}" - }, - { - "key": "roleId", - "value": "{{dataOfficerRole}}" - } - ] - } - }, - "response": [] - } - ] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Project-GetAllProjects-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\") + 5000);", - "", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "Project-CreateProjectToFollow-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", - "var projectName = pm.environment.get(\"projectName\");", - "var adminUserName = pm.environment.get(\"adminUserName\");", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"projectIdToFollow\", jsonData.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});", - "", - "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", - " pm.expect(jsonData.user.name).to.eql(adminUserName);", - "});", - "", - "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", - " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_ProjectToFollow\",\r\n \"shortDescription\": \"postmantest_ProjectToFollow\",\r\n \"uri\": \"postmantest_ProjectToFollow\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_ProjectToFollow\",\r\n \"role\": \"postmantest_ProjectToFollow\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "User-CreateUserToFollow-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var userName = pm.environment.get(\"userName\");", - "", - "var jsonData = pm.response.json();", - "pm.environment.set(\"userIdToFollow\", jsonData.id)", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if created Username matches: \" + userName, function () {", - " pm.expect(jsonData.name).to.eql(userName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"999\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_UserToFollow@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - }, - { - "name": "CreateProjectToBeDeletedByUnauthorizedRoles", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "pm.environment.set(\"projectToBeDeletedByUnauthorizedRoles\", jsonData.id);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_ProjectToBeDeletedByUnauthorizedRoles\",\r\n \"shortDescription\": \"postmantest_ProjectToBeDeletedByUnauthorizedRoles\",\r\n \"uri\": \"postmantest_ProjectToBeDeletedByUnauthorizedRoles\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_ProjectToBeDeletedByUnauthorizedRoles\",\r\n \"role\": \"postmantest_ProjectToBeDeletedByUnauthorizedRoles\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - } - ], - "description": "Warmup the API to ensure fast response times" - } - ] -} \ No newline at end of file From 71831700a7ea306ffcac65d6951305dc198131ef Mon Sep 17 00:00:00 2001 From: "Noorden,Andrew A.J.J" Date: Fri, 5 Mar 2021 11:05:17 +0100 Subject: [PATCH 04/19] Revert "acl + cleanup collecties" This reverts commit 0e36027a403c80b5a8192655537d9a831e07d1e0. --- Postman/dex-acl.postman_collection.json | 19008 ------------------ Postman/dex-cleanup.postman_collection.json | 391 - 2 files changed, 19399 deletions(-) delete mode 100644 Postman/dex-acl.postman_collection.json delete mode 100644 Postman/dex-cleanup.postman_collection.json diff --git a/Postman/dex-acl.postman_collection.json b/Postman/dex-acl.postman_collection.json deleted file mode 100644 index bb24fe58..00000000 --- a/Postman/dex-acl.postman_collection.json +++ /dev/null @@ -1,19008 +0,0 @@ -{ - "info": { - "_postman_id": "94a3ee22-6e94-44ba-bd40-035ccf050ac1", - "name": "DEV-ACL", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "ACL", - "item": [ - { - "name": "Administrator", - "item": [ - { - "name": "User", - "item": [ - { - "name": "User-CreateUser-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var userName = pm.environment.get(\"userName\");", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"createdUserId\", jsonData.id);", - "pm.environment.set(\"createdUserIdentityId\", jsonData.identityId);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Check if created Username matches: \" + userName, function () {", - " pm.expect(jsonData.name).to.eql(userName);", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"999\",\n \"name\": \"{{userName}}\",\n \"email\": \"User-CreateUser-Administrator@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - }, - { - "name": "User-GetUser-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", - "var createdUserIdentityId = pm.environment.get(\"createdUserIdentityId\");", - "var userName = pm.environment.get(\"userName\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if updated identity Id matches: \" + createdUserIdentityId, function () {", - " pm.expect(jsonData.identityId).to.eql(createdUserIdentityId);", - "});", - "", - "pm.test(\"Check if updated Id matches: \" + createdUserId, function () {", - " pm.expect(jsonData.id).to.eql(createdUserId);", - "});", - "", - "pm.test(\"Check previously created UserName with id \" + userName, function () {", - " pm.expect(jsonData.name).to.eql(userName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-UpdateUser-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var userName = pm.environment.get(\"userNameUpdated\");", - "pm.environment.set(\"userName\", userName);", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if updated username matches: \" + userName, function () {", - " pm.expect(jsonData.name).to.eql(userName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{userNameUpdated}}\",\r\n \"email\": \"User-CreateUser-Administrator\",\r\n \"identityId\": \"{{createdUserIdentityId}}\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-GetUpdatedUser-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var createdUserId = parseInt(pm.environment.get(\"createdUserId\"));", - "var createdUserIdentityId = pm.environment.get(\"createdUserIdentityId\");", - "var userName = pm.environment.get(\"userName\")", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if updated identity Id matches: \" + createdUserIdentityId, function () {", - " pm.expect(jsonData.identityId).to.eql(createdUserIdentityId);", - "});", - "", - "pm.test(\"Check if updated Id matches: \" + createdUserId, function () {", - " pm.expect(jsonData.id).to.eql(createdUserId);", - "});", - "", - "pm.test(\"Check if updated username matches: \" + userName, function () {", - " pm.expect(jsonData.name).to.eql(userName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserId}}" - ], - "query": [ - { - "key": "", - "value": "", - "disabled": true - } - ] - } - }, - "response": [] - }, - { - "name": "User-GetUser-Self-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var administratorUserIdentityId = parseInt(pm.environment.get(\"administratorUserIdentityId\"));", - "", - "var jsonData = pm.response.json();", - "pm.environment.set(\"administratorUserId\", jsonData.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Identity ID is correct and matching: \" + administratorUserIdentityId, function () {", - " pm.expect(parseInt(jsonData.identityId)).to.eql(administratorUserIdentityId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "FollowUser", - "item": [ - { - "name": "User-FollowUser-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "var userIdToFollow = pm.environment.get(\"userIdToFollow\");", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if created Username matches: \" + userIdToFollow, function () {", - " pm.expect(jsonData.id).to.eql(userIdToFollow);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "follow", - "{{userIdToFollow}}" - ] - } - }, - "response": [] - }, - { - "name": "User-UnFollowUser-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "follow", - "{{userIdToFollow}}" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Project", - "item": [ - { - "name": "Project-CreateProject-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", - "var projectName = pm.environment.get(\"projectName\");", - "var adminUserName = pm.environment.get(\"adminUserName\");", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"projectId\", jsonData.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});", - "", - "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", - " pm.expect(jsonData.user.name).to.eql(adminUserName);", - "});", - "", - "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", - " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_Project-CreateProject-Administrator\",\r\n \"shortDescription\": \"postmantest_Project-CreateProject-Administrator\",\r\n \"uri\": \"postmantest_Project-CreateProject-Administrator\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Project-CreateProject-Administrator\",\r\n \"role\": \"postmantest_Project-CreateProject-Administrator\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "Project-GetAllProjects-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectName = pm.environment.get(\"projectName\");", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findProject(jsonData, name) {", - " for (var i = 0; i < jsonData.results.length; i++) {", - " if (jsonData.results[i].name == name) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project: \" + projectName + \" is in list\", function () {", - " foundAt = findProject(jsonData, projectName);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "", - "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "Project-GetProject-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectId = parseInt(pm.environment.get(\"projectId\"));", - "var projectName = pm.environment.get(\"projectName\");", - "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", - "var adminUserName = pm.environment.get(\"adminUserName\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"ProjectName is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});", - "", - "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", - " pm.expect(jsonData.user.name).to.eql(adminUserName);", - "});", - "", - "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", - " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-UpdateProject-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectName = pm.environment.get(\"projectNameUpdated\");", - "pm.environment.set(\"projectName\", projectName);", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_Project-UpdateProject-Administrator\",\r\n \"shortDescription\": \"postmantest_Project-UpdateProject-Administrator\",\r\n \"uri\": \"postmantest_Project-UpdateProject-Administrator\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Project-UpdateProject-Administrator\",\r\n \"role\": \"postmantest_Project-UpdateProject-Administrator\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-GetUpdatedProject-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", - "var projectName = pm.environment.get(\"projectName\");", - "var adminUserName = pm.environment.get(\"adminUserName\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"ProjectName is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});", - "", - "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", - " pm.expect(jsonData.user.name).to.eql(adminUserName);", - "});", - "", - "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", - " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-GetProject-NonExisting-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/98989", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "98989" - ] - } - }, - "response": [] - }, - { - "name": "Project-LikeProject-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.ok;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "like", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-DeleteLikeProject-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.ok;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "like", - "{{projectId}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "FollowProject", - "item": [ - { - "name": "Project-FollowProject-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "var projectId = pm.environment.get(\"projectIdToFollow\");", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if created Username matches: \" + projectId, function () {", - " pm.expect(jsonData.id).to.eql(projectId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "project", - "follow", - "{{projectIdToFollow}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-UnFollowProject-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "project", - "follow", - "{{projectIdToFollow}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Highlight", - "item": [ - { - "name": "Highlight-CreateHighlight-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var identityId = parseInt(pm.environment.get(\"identityId\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"highlightId\", jsonData.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", - "\r", - "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", - "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postmantest_Highlight-CreateHighlight-Administrator\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Highlight", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetAllActiveHighlights-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectId = pm.environment.get(\"projectId\");", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findItem(jsonData, item) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].projectId == item) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Highlight is in list and matching: \" + projectId, function () {", - " foundAt = findItem(jsonData, projectId);", - " pm.expect(foundAt).to.not.eql(-1);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetHighlight-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var identityId = parseInt(pm.environment.get(\"identityId\"));", - "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", - "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Highlight Id matches: \" + highlightId, function () {", - " pm.expect(jsonData.id).to.eql(highlightId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{highlightId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetHighlight-ByProject-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var identityId = parseInt(pm.environment.get(\"identityId\"));", - "var projectId = parseInt(pm.environment.get(\"projectId\"));", - "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findHighlightId(jsonData, item) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].id == item) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "function findProjectId(jsonData, item) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].projectId == item) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project is in list and matching: \" + projectId, function () {", - " foundAt = findProjectId(jsonData, projectId);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "", - "pm.test(\"Highlight is in list and matching:\" + highlightId, function () {", - " foundAt = findHighlightId(jsonData, highlightId);", - " pm.expect(foundAt).to.not.eql(-1);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-UpdateHighlight-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var highlightStartDate = pm.environment.get(\"highlightStartDate\");", - "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Highlight Id matches: \" + highlightId, function () {", - " pm.expect(jsonData.id).to.eql(highlightId);", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postmantest_Highlight-UpdateHighlight-Administrator\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{highlightId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetUpdatedHighlight-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var highlightUpdateTimestamp = pm.environment.get(\"current_timestamp\");", - "var highlightEndDate = pm.environment.get(\"highlightEndDate\");", - "var highlightId = pm.environment.get(\"highlightId\");", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Highlight Id matches: \" + highlightId, function () {", - " pm.expect(jsonData.id).to.eql(highlightId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{highlightId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetHighlight-NonExisting-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight/98989", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "98989" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Embed", - "item": [ - { - "name": "Embed-CreateEmbed-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"embedGuid\", jsonData.guid);", - "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "Embed-GetAllEmbeds-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var embedGuid = pm.environment.get(\"embedGuid\");", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findItem(jsonData, item) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].guid == item) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Embed is in list and matches: \" + embedGuid, function () {", - " foundAt = findItem(jsonData, embedGuid);", - " pm.expect(foundAt).to.not.eql(-1);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "Embed-GetEmbed-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Embed matches: \" + embeddedProjectId, function () {", - " pm.expect(jsonData.id).to.eql(embeddedProjectId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed", - "{{embedGuid}}" - ] - } - }, - "response": [] - }, - { - "name": "Embed-GetEmbed-NonExisting-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed/cdaadc49-b4b9-4c11-8937-e602174cba30", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed", - "cdaadc49-b4b9-4c11-8937-e602174cba30" - ] - } - }, - "response": [] - }, - { - "name": "Embed-GetEmbed-NonExisting-NoGUID-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed/98989", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed", - "98989" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Role", - "item": [ - { - "name": "Role-CreateRole-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var scopeName = pm.environment.get(\"scopeName\");", - "var roleName = pm.environment.get(\"roleName\");", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"roleId\", jsonData.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Role Name is set correctly and matching: \" + roleName, function () {", - " pm.expect(jsonData.name).to.eql(roleName);", - "});", - "", - "pm.test(\"Scope is correct and matching: \" + scopeName, function () {", - " pm.expect(jsonData.scopes.scope).to.eql(scopeName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Role", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role" - ] - }, - "description": "Is deleted in the latest cleanup folder" - }, - "response": [] - }, - { - "name": "Role-GetAllRoles-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var roleName = pm.environment.get(\"roleName\");", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findProject(jsonData, name) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].name == name) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Role: \" + roleName + \" is in list\", function () {", - " foundAt = findProject(jsonData, roleName);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "", - "pm.test(\"Role Name is set correctly with matching: \" + roleName, function () {", - " pm.expect(jsonData[foundAt].name).to.eql(roleName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role" - ] - } - }, - "response": [] - }, - { - "name": "Scope-GetAllScopes-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var identityId = parseInt(pm.environment.get(\"identityId\"));", - "var projectName = pm.environment.get(\"projectName\");", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findProject(jsonData, name) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].name == name) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role/Scopes", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "Scopes" - ] - } - }, - "response": [] - }, - { - "name": "Role-GetRole-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var roleId = parseInt(pm.environment.get(\"roleId\"));", - "var roleName = pm.environment.get(\"roleName\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Role Name is set correctly\", function () {", - " pm.expect(jsonData.name).to.eql(roleName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "{{roleId}}" - ] - } - }, - "response": [] - }, - { - "name": "Role-UpdateRole-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Role Name is set correctly\", function () {", - " pm.expect(jsonData.name).to.eql(updatedRoleName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "{{roleId}}" - ] - } - }, - "response": [] - }, - { - "name": "Role-GetUpdatedRole-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var updatedRoleName = pm.environment.get(\"updatedRoleName\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Role Name is set correctly and matches: \" + updatedRoleName, function () {", - " pm.expect(jsonData.name).to.eql(updatedRoleName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "{{roleId}}" - ] - } - }, - "response": [] - }, - { - "name": "Role-SetRole-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var roleId = parseInt(pm.environment.get(\"roleId\"));", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Role is set correctly and matches: \" + roleId, function () {", - " pm.expect(jsonData.role.id).to.eql(roleId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Role/setRole?userId={{createdUserId}}&roleId={{roleId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "setRole" - ], - "query": [ - { - "key": "userId", - "value": "{{createdUserId}}", - "description": "Id of the user that we want to update" - }, - { - "key": "roleId", - "value": "{{roleId}}", - "description": "Id of the role that you want to update the user with" - } - ] - } - }, - "response": [] - }, - { - "name": "User-GetRole-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var roleId = parseInt(pm.environment.get(\"roleId\"));", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if user has role that matches: \" + roleId, function () {", - " pm.expect(jsonData.role.id).to.eql(roleId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserId}}" - ] - } - }, - "response": [] - }, - { - "name": "Role-GetRole-NonExisting-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role/98989", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "98989" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Search", - "item": [ - { - "name": "Search-SearchInternal-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectName = pm.environment.get(\"projectName\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.results[0].name).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Search/internal/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Search", - "internal", - "{{projectId}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Wizard", - "item": [] - }, - { - "name": "Institution", - "item": [ - { - "name": "Institution-CreateInstitution-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var institutionName = pm.environment.get(\"institutionName\");", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"createdInstitutionId\", jsonData.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if created Name matches: \" + institutionName, function () {", - " pm.expect(jsonData.name).to.eql(institutionName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"{{institutionName}}\",\n \"description\": \"postmantest_Institution-CreateInstitution-Administrator\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Institution", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Institution" - ] - } - }, - "response": [] - }, - { - "name": "Institution-GetInstitution-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var createdInstitutionId = parseInt(pm.environment.get(\"createdInstitutionId\"));", - "var institutionName = pm.environment.get(\"institutionName\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if updated Id matches: \" + createdInstitutionId, function () {", - " pm.expect(jsonData.id).to.eql(createdInstitutionId);", - "});", - "", - "pm.test(\"Check previously created UserName with id \" + institutionName, function () {", - " pm.expect(jsonData.name).to.eql(institutionName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Institution", - "{{createdInstitutionId}}" - ] - } - }, - "response": [] - }, - { - "name": "Institution-UpdateInstitution-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var institutionName = pm.environment.get(\"updatedInstitutionName\");", - "pm.environment.set(\"institutionName\", institutionName);", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if updated Institution Name matches: \" + institutionName, function () {", - " pm.expect(jsonData.name).to.eql(institutionName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{updatedInstitutionName}}\",\r\n \"description\": \"postmantest_Institution-UpdateInstitution-Administrator\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Institution", - "{{createdInstitutionId}}" - ] - } - }, - "response": [] - }, - { - "name": "Institution-GetUpdatedInstitution-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var createdInstitutionId = parseInt(pm.environment.get(\"createdInstitutionId\"));", - "var institutionName = pm.environment.get(\"institutionName\")", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if updated Institution Id matches: \" + createdInstitutionId, function () {", - " pm.expect(jsonData.id).to.eql(createdInstitutionId);", - "});", - "", - "pm.test(\"Check if updated institution matches: \" + institutionName, function () {", - " pm.expect(jsonData.name).to.eql(institutionName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Institution", - "{{createdInstitutionId}}" - ], - "query": [ - { - "key": "", - "value": "", - "disabled": true - } - ] - } - }, - "response": [] - } - ] - }, - { - "name": "File", - "item": [ - { - "name": "File-CreateFile-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "pm.environment.set(\"adminFileId\", jsonData.id)\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response time is less than 800ms\", function () {\r", - " pm.expect(pm.response.responseTime).to.be.below(800);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.success;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});\r", - "\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "File", - "type": "file", - "src": "Postman/testimage.png" - } - ] - }, - "url": { - "raw": "{{apiUrl}}/api/File", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "File" - ] - } - }, - "response": [] - }, - { - "name": "Files-GetAll-Adminstrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.success;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/File", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "File" - ] - } - }, - "response": [] - }, - { - "name": "File-Delete-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid\", function () {\r", - " pm.response.to.be.ok;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/File/{{adminFileId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "File", - "{{adminFileId}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "CallToActionOption", - "item": [ - { - "name": "CallToActionOption-CreateCallToActionOption-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"callToActionOptionId\", jsonData.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Call to action option type is lowercase\", function () {", - " pm.expect(jsonData.type).to.eql(jsonData.type.toLowerCase());", - "});", - "", - "pm.test(\"Call to action option value is lowercase\", function () {", - " pm.expect(jsonData.value).to.eql(jsonData.value.toLowerCase());", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"type\": \"postman_CallToActionOption-CreateCallToActionOption-Administrator\",\r\n \"value\": \"postman_CallToActionOption-CreateCallToActionOption-Administrator\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-GetAllCallToActionOptions-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var optionId = parseInt(pm.environment.get(\"callToActionOptionId\"));", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findOption(jsonData, id) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].id == id) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Call to action option with id: \" + optionId + \" is in list\", function () {", - " foundAt = findOption(jsonData, optionId);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-GetCallToActionOptionById-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"callToActionOptionType\", jsonData.type);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Call to action option type is lowercase\", function () {", - " pm.expect(jsonData.type).to.eql(jsonData.type.toLowerCase());", - "});", - "", - "pm.test(\"Call to action option value is lowercase\", function () {", - " pm.expect(jsonData.value).to.eql(jsonData.value.toLowerCase());", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"type\": \"Title\",\r\n \"value\": \"Collaborate\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-GetCallToActionOptionByType-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var callToActionOptionId = parseInt(pm.environment.get(\"callToActionOptionId\"));", - "", - "var jsonData = pm.response.json();", - "", - "function findOptionType(jsonData, id) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].id == id) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Call to action option id is \" + callToActionOptionId, function() {", - " foundAt = findOptionType(jsonData, callToActionOptionId);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/type/{{callToActionOptionType}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "type", - "{{callToActionOptionType}}" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-UpdateCallToActionOption-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var updatedCallToActionType = pm.environment.get(\"updatedCallToActionType\");", - "var updatedCallToActionValue = pm.environment.get(\"updatedCallToActionValue\");", - "pm.environment.set(\"callToActionOptionType\", updatedCallToActionType);", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if updated Call to action Type matches: \" + updatedCallToActionType, function () {", - " pm.expect(jsonData.type).to.eql(updatedCallToActionType);", - "});", - "", - "pm.test(\"Check if updated Call to action Value matches: \" + updatedCallToActionValue, function () {", - " pm.expect(jsonData.value).to.eql(updatedCallToActionValue);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"type\": \"{{updatedCallToActionType}}\",\r\n \"value\": \"{{updatedCallToActionValue}}\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Cleanup", - "item": [ - { - "name": "Embed-DeleteEmbed-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed", - "{{embedGuid}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-DeleteHighlight-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{highlightId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-DeleteProject-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Role-DeleteRole-WithUsers-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "{{roleId}}" - ] - } - }, - "response": [] - }, - { - "name": "Institution-DeleteInstitution-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Institution", - "{{createdInstitutionId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-DeleteUser-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserId}}" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-DeleteCallToActionOption-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Checkup-on-Cleanup", - "item": [ - { - "name": "Project-Get-Deleted-Project-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-Get-Deleted-User-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserId}}" - ] - } - }, - "response": [] - }, - { - "name": "Embed-Get-Deleted-Embed-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed", - "{{embedGuid}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-Get-Deleted-Highlight-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{highlightId}}" - ] - } - }, - "response": [] - }, - { - "name": "Institution-Get-Deleted-Institution-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 404\", function () {", - " pm.response.to.have.status(404);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.notFound;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Institution", - "{{createdInstitutionId}}" - ] - } - }, - "response": [] - } - ] - } - ] - }, - { - "name": "Guest", - "item": [ - { - "name": "Preparation", - "item": [ - { - "name": "Project-CreateProject", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", - "var projectName = pm.environment.get(\"projectName\");", - "var adminUserName = pm.environment.get(\"adminUserName\");", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"projectId\", jsonData.id);", - "pm.environment.set(\"adminProjectId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});", - "", - "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", - " pm.expect(jsonData.user.name).to.eql(adminUserName);", - "});", - "", - "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", - " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_Guest_Project-CreateProject\",\r\n \"shortDescription\": \"postmantest_Guest_Project-CreateProject\",\r\n \"uri\": \"postmantest_Guest_Project-CreateProject-CreateProjecttest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Guest_Project-CreateProject\",\r\n \"role\": \"postmantest_Guest_Project-CreateProject\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-CreateHighlight", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var identityId = parseInt(pm.environment.get(\"identityId\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"highlightId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", - "\r", - "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", - "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postman_Highlight-CreateHighlight\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Highlight", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight" - ] - } - }, - "response": [] - }, - { - "name": "Embed-CreateEmbed", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"embedGuid\", jsonData.guid);", - "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-CreateCallToActionOption", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"callToActionOptionId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Call to action option type is lowercase\", function () {", - " pm.expect(jsonData.type).to.eql(jsonData.type.toLowerCase());", - "});", - "", - "pm.test(\"Call to action option value is lowercase\", function () {", - " pm.expect(jsonData.value).to.eql(jsonData.value.toLowerCase());", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"type\": \"Title\",\r\n \"value\": \"Feedback\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption" - ] - } - }, - "response": [] - } - ], - "description": "For some requests, we need to have data available. The variables need to be filled so the request can succeed. We put these preparation requests in this folder. We will clean them up in the cleanup folder.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "User", - "item": [ - { - "name": "User-CreateUser-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"postman_User-CreateUser-Guest\",\n \"email\": \"postman_User-CreateUser-Guest@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - }, - { - "name": "User-GetUser-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/User/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "1" - ] - } - }, - "response": [] - }, - { - "name": "User-UpdateUser-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "1" - ] - } - }, - "response": [] - }, - { - "name": "User-DeleteUser-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/User/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "1" - ] - } - }, - "response": [] - } - ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "FollowUser", - "item": [ - { - "name": "User-FollowUser-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "follow", - "{{userIdToFollow}}" - ] - } - }, - "response": [] - }, - { - "name": "User-UnFollowUser-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "follow", - "{{userIdToFollow}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Project", - "item": [ - { - "name": "Project-CreateProject-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "Project-GetAllProjects-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectName = pm.environment.get(\"projectName\");", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findProject(jsonData, name) {", - " for (var i = 0; i < jsonData.results.length; i++) {", - " if (jsonData.results[i].name == name) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project: \" + projectName + \" is in list\", function () {", - " foundAt = findProject(jsonData, projectName);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "", - "pm.test(\"Project name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "Project-GetProject-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectName = pm.environment.get(\"projectName\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-UpdateProject-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "1" - ] - } - }, - "response": [] - }, - { - "name": "Project-DeleteProject-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Project/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "1" - ] - } - }, - "response": [] - }, - { - "name": "Project-LikeProject-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 401\", function () {\r", - " pm.response.to.have.status(401);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.unauthorized;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text", - "disabled": true - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "like", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-DeleteLikeProject-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 401\", function () {\r", - " pm.response.to.have.status(401);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.unauthorized;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "value": "{{registeredUserIdentityId}}", - "type": "text", - "disabled": true - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "like", - "{{projectId}}" - ] - } - }, - "response": [] - } - ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "FollowProject", - "item": [ - { - "name": "Project-FollowProject-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "project", - "follow", - "{{projectIdToFollow}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-UnFollowProject-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "", - "disabled": true - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "project", - "follow", - "{{projectIdToFollow}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Highlight", - "item": [ - { - "name": "Highlight-CreateHighlight-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Highlight", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetAllActiveHighlights-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Highlight", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetHighlight-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", - "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Highlight Id matches: \" + highlightId, function () {", - " pm.expect(jsonData.id).to.eql(highlightId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{highlightId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetHighlight-ByProject-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-UpdateHighlight-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{highlightId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-DeleteHighlight-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{highlightId}}" - ] - } - }, - "response": [] - } - ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Embed", - "item": [ - { - "name": "Embed-CreateEmbed-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "Embed-GetAllEmbeds-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "Embed-GetEmbed-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed", - "{{embedGuid}}" - ] - } - }, - "response": [] - }, - { - "name": "Embed-DeleteEmbed-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed", - "{{embedGuid}}" - ] - } - }, - "response": [] - } - ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Role", - "item": [ - { - "name": "Role-CreateRole-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Role", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role" - ] - } - }, - "response": [] - }, - { - "name": "Role-GetAllRoles-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Role", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role" - ] - } - }, - "response": [] - }, - { - "name": "Scope-GetAllScopes-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Role/Scopes", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "Scopes" - ] - } - }, - "response": [] - }, - { - "name": "Role-GetRole-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Role/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "1" - ] - } - }, - "response": [] - }, - { - "name": "Role-UpdateRole-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Role/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "1" - ] - } - }, - "response": [] - }, - { - "name": "Role-SetRole-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"createdUserId\": {{createdUserId}},\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId=1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "setRole" - ], - "query": [ - { - "key": "createdUserId", - "value": "{{createdUserId}}", - "description": "Id of the user that we want to update" - }, - { - "key": "roleId", - "value": "1", - "description": "Id of the role that you want to update the user with" - } - ] - } - }, - "response": [] - }, - { - "name": "Role-DeleteRole-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "", - "disabled": true - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "{{roleId}}" - ] - } - }, - "response": [] - } - ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Search", - "item": [ - { - "name": "Search-SearchInternal-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Search/internal/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Search", - "internal", - "1" - ] - } - }, - "response": [] - } - ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Wizard", - "item": [], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Institution", - "item": [ - { - "name": "Institution-CreateInstitution-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"{{institutionName}}\",\n \"description\": \"postmantest_initial_description\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Institution", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Institution" - ] - } - }, - "response": [] - }, - { - "name": "Institution-GetInstitution-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Institution/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Institution", - "1" - ] - } - }, - "response": [] - }, - { - "name": "Institution-UpdateInstitution-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{institutionName}}\",\r\n \"description\": \"postmantest_initial_description\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Institution/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Institution", - "1" - ] - } - }, - "response": [] - }, - { - "name": "Instituiton-DeleteInstitution-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/Institution/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Institution", - "1" - ] - } - }, - "response": [] - } - ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "File", - "item": [ - { - "name": "Post-File-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 401\", function () {\r", - " pm.response.to.have.status(401);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.unauthorized;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "File", - "type": "file", - "src": "Postman/testimage.png" - } - ] - }, - "url": { - "raw": "{{apiUrl}}/api/File", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "File" - ] - } - }, - "response": [] - }, - { - "name": "Get-Files-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 401\", function () {\r", - " pm.response.to.have.status(401);\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/File", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "File" - ] - } - }, - "response": [] - }, - { - "name": "File-Delete-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 401\", function () {\r", - " pm.response.to.have.status(401);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.unauthorized;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "DELETE", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/File/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "File", - "1" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "CallToActionOption", - "item": [ - { - "name": "CallToActionOption-CreateCallToActionOption-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"type\": \"Title\",\n \"value\": \"Provide feedback\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-GetAllCallToActionOptions-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-GetCallToActionOptionById-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-GetCallToActionOptionByType-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/type/{{callToActionOptionType}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "type", - "{{callToActionOptionType}}" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-UpdateCallToActionOption-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"type\": \"Updated type\",\r\n \"value\": \"Updated value\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-DeleteCallToActionOption-Guest", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - } - ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Cleanup Administrator", - "item": [ - { - "name": "CallToActionOption-DeleteCallToActionOption-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-DeleteProject-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{adminProjectId}}" - ] - } - }, - "response": [] - } - ] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Registered", - "item": [ - { - "name": "Preparation", - "item": [ - { - "name": "User-CreateUser", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var userName = pm.environment.get(\"userName\");", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"createdUserId\", jsonData.id);", - "pm.environment.set(\"identityId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Check if created Username matches: \" + userName, function () {", - " pm.expect(jsonData.name).to.eql(userName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"9996\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_Registered_User-CreateUser@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - }, - { - "name": "Project-CreateProject", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", - "var projectName = pm.environment.get(\"projectName\");", - "var adminUserName = pm.environment.get(\"adminUserName\");", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"projectId\", jsonData.id);", - "pm.environment.set(\"adminProjectId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});", - "", - "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", - " pm.expect(jsonData.user.name).to.eql(adminUserName);", - "});", - "", - "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", - " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_Registered-Project-CreateProject\",\r\n \"shortDescription\": \"postmantest_Registered-Project-CreateProject\",\r\n \"uri\": \"postmantest_Registered-Project-CreateProject\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Registered-Project-CreateProject\",\r\n \"role\": \"postmantest_Registered-Project-CreateProject\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-CreateHighlight", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var identityId = parseInt(pm.environment.get(\"identityId\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"highlightId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", - "\r", - "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", - "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postman_Registered_Highlight-CreateHighlight\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Highlight", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight" - ] - } - }, - "response": [] - }, - { - "name": "Embed-CreateEmbed", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"embedGuid\", jsonData.guid);", - "pm.environment.set(\"adminEmbedGuid\", jsonData.guid);", - "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-CreateCallToActionOption", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"callToActionOptionId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Call to action option type is lowercase\", function () {", - " pm.expect(jsonData.type).to.eql(jsonData.type.toLowerCase());", - "});", - "", - "pm.test(\"Call to action option value is lowercase\", function () {", - " pm.expect(jsonData.value).to.eql(jsonData.value.toLowerCase());", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"type\": \"Title\",\r\n \"value\": \"Feedback\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption" - ] - } - }, - "response": [] - } - ], - "description": "For some requests, we need to have data available. The variables need to be filled so the request can succeed. We put these preparation requests in this folder. We will clean them up in the cleanup folder.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "User", - "item": [ - { - "name": "User-CreateUser-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var jsonData = pm.response.json();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - }, - { - "name": "User-GetUser-Other-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-GetUser-Self-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var aliceIdentityId = parseInt(pm.environment.get(\"registeredUserIdentityId\"));", - "", - "var jsonData = pm.response.json();", - "pm.environment.set(\"registeredUserId\", jsonData.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Identity ID is correct and matching: \" + aliceIdentityId, function () {", - " pm.expect(parseInt(jsonData.identityId)).to.eql(aliceIdentityId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - }, - { - "name": "User-UpdateUser-Self-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if email update matches: \" + updatedAliceEmail, function () {", - " pm.expect(jsonData.email).to.eql(updatedAliceEmail);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"postman_User-UpdateUser-Self-Registered_alicez\",\r\n \"email\": \"{{updatedAliceEmail}}\",\r\n \"identityId\": \"{{registeredUserIdentityId}}\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/{{registeredUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{registeredUserId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-UpdateUser-Other-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-DeleteUser-Other-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserId}}" - ] - } - }, - "response": [] - } - ], - "description": "Requests executed as the Alice user with the registered role.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "FollowUser", - "item": [ - { - "name": "User-FollowUser-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "var userId = pm.environment.get(\"userIdToFollow\");", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if created Username matches: \" + userId, function () {", - " pm.expect(jsonData.id).to.eql(userId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "follow", - "{{userIdToFollow}}" - ] - } - }, - "response": [] - }, - { - "name": "User-UnFollowUser-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "follow", - "{{userIdToFollow}}" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Project", - "item": [ - { - "name": "Project-CreateProject-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var registeredUserId = pm.environment.get(\"registeredUserId\");", - "var projectName = pm.environment.get(\"projectName\");", - "", - "var jsonData = pm.response.json();", - "pm.environment.set(\"projectId\", jsonData.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});", - "", - "pm.test(\"Identity Id is set correctly and matches: \" + registeredUserId, function () {", - " pm.expect(jsonData.user.id).to.eql(registeredUserId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_Project-CreateProject-Registered\",\r\n \"shortDescription\": \"postmantest_Project-CreateProject-Registered\",\r\n \"uri\": \"postmantest_Project-CreateProject-Registered\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Project-CreateProject-Registered\",\r\n \"role\": \"postmantest_Project-CreateProject-Registered\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "Project-GetAllProjects-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectName = pm.environment.get(\"projectName\");", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findProject(jsonData, name) {", - " for (var i = 0; i < jsonData.results.length; i++) {", - " if (jsonData.results[i].name == name) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project: \" + projectName + \" is in list\", function () {", - " foundAt = findProject(jsonData, projectName);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "", - "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "Project-GetProject-Self-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectName = pm.environment.get(\"projectName\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-GetProject-Other-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{adminProjectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-UpdateProject-Self-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectName = pm.environment.get(\"projectNameUpdated\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_Project-CreateProject-Registered\",\r\n \"shortDescription\": \"postmantest_Project-CreateProject-Registered\",\r\n \"uri\": \"postmantest_Project-CreateProject-Registered\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Project-CreateProject-Registered\",\r\n \"role\": \"postmantest_Project-CreateProject-Registered\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-UpdateProject-Other-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{adminProjectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-LikeProject-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.ok;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{registeredUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "like", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-DeleteLikeProject-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.ok;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "like", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-DeleteProject-Other-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectToBeDeletedByUnauthorizedRoles}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectToBeDeletedByUnauthorizedRoles}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "FollowProject", - "item": [ - { - "name": "Project-FollowProject-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectId = pm.environment.get(\"projectIdToFollow\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if created Username matches: \" + projectId, function () {", - " pm.expect(jsonData.id).to.eql(projectId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "project", - "follow", - "{{projectIdToFollow}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-UnFollowProject-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "project", - "follow", - "{{projectIdToFollow}}" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Embed", - "item": [ - { - "name": "Embed-CreateEmbed-Self-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"embedGuid\", jsonData.guid);", - "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "Embed-CreateEmbed-Other-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{adminProjectId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "Embed-GetAllEmbeds-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "Embed-GetEmbed-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Embed matches: \" + embeddedProjectId, function () {", - " pm.expect(jsonData.id).to.eql(embeddedProjectId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed", - "{{embedGuid}}" - ] - } - }, - "response": [] - }, - { - "name": "Embed-DeleteEmbed-Self-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed", - "{{embedGuid}}" - ] - } - }, - "response": [] - }, - { - "name": "Embed-DeleteEmbed-Other-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed/{{adminEmbedGuid}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed", - "{{adminEmbedGuid}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Highlight", - "item": [ - { - "name": "Highlight-CreateHighlight-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", - "\r", - "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", - "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Highlight", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetAllActiveHighlights-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectId = pm.environment.get(\"adminProjectId\");", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findItem(jsonData, item) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].projectId == item) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Highlight is in list and matching: \" + projectId, function () {", - " foundAt = findItem(jsonData, projectId);", - " pm.expect(foundAt).to.not.eql(-1);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetHighlight-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var identityId = parseInt(pm.environment.get(\"identityId\"));", - "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", - "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Highlight Id matches: \" + highlightId, function () {", - " pm.expect(jsonData.id).to.eql(highlightId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{highlightId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetHighlight-ByProject-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-UpdateHighlight-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "value": "{{registeredUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{highlightId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-DeleteHighlight-Other-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{highlightId}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Role", - "item": [ - { - "name": "Role-CreateRole-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Role", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role" - ] - } - }, - "response": [] - }, - { - "name": "Role-GetAllRoles-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role" - ] - } - }, - "response": [] - }, - { - "name": "Scope-GetAllScopes-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role/Scopes", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "Scopes" - ] - } - }, - "response": [] - }, - { - "name": "Role-GetRole-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "{{roleId}}" - ] - } - }, - "response": [] - }, - { - "name": "Role-UpdateRole-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "{{roleId}}" - ] - } - }, - "response": [] - }, - { - "name": "Role-SetRole-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"createdUserId\": {{createdUserId}},\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId={{roleId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "setRole" - ], - "query": [ - { - "key": "createdUserId", - "value": "{{createdUserId}}", - "description": "Id of the user that we want to update" - }, - { - "key": "roleId", - "value": "{{roleId}}", - "description": "Id of the role that you want to update the user with" - } - ] - } - }, - "response": [] - }, - { - "name": "Role-DeleteRole-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "{{roleId}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Search", - "item": [ - { - "name": "Search-SearchInternal-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Search/internal/{{projectName}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Search", - "internal", - "{{projectName}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Wizard", - "item": [] - }, - { - "name": "Institution", - "item": [ - { - "name": "Institution-CreateInstitution-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{registeredUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - }, - { - "name": "Institution-GetInstitution-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "GET", - "header": [ - { - "key": "IdentityId", - "value": "{{registeredUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "1" - ] - } - }, - "response": [] - }, - { - "name": "Institution-UpdateInstitution-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "value": "{{registeredUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "1" - ] - } - }, - "response": [] - }, - { - "name": "Instituiton-DeleteInstitution-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "value": "{{registeredUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "1" - ] - } - }, - "response": [] - } - ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "ProjectIcon", - "item": [ - { - "name": "ProjectIcon-Post-File-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response includes fileId\", function () {\r", - " pm.expect(jsonData.id).to.exist;\r", - "})\r", - "\r", - "pm.environment.set(\"ProjectIconRegisteredFileId\", jsonData.id);\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.success;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{registeredUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "File", - "type": "file", - "src": "Postman/testimage.png" - } - ] - }, - "url": { - "raw": "{{apiUrl}}/api/File", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "File" - ] - } - }, - "response": [] - }, - { - "name": "ProjectIcon-CreateProject-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var registeredUserId = pm.environment.get(\"registeredUserId\");", - "var projectName = pm.environment.get(\"projectName\");", - "", - "var jsonData = pm.response.json();", - "pm.environment.set(\"ProjectIconProjectId\", jsonData.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"shortDescription\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"uri\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"role\": \"postmantest_ProjectIcon-CreateProject-Registered\"\r\n }\r\n ],\r\n \"fileId\": {{ProjectIconRegisteredFileId}},\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "ProjectIcon-GetProject-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectName = pm.environment.get(\"projectName\");", - "var ProjectIconRegisteredFileId = pm.environment.get(\"ProjectIconRegisteredFileId\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});", - "", - "pm.test(\"ProjectIconId is set correctly and matches: \" + ProjectIconRegisteredFileId, function () {", - " pm.expect(jsonData.projectIcon.id).to.eql(ProjectIconRegisteredFileId)", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{ProjectIconProjectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{ProjectIconProjectId}}" - ] - } - }, - "response": [] - }, - { - "name": "ProjectIcon-GetIcon-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.ok;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/file/{{ProjectIconRegisteredFileId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "file", - "{{ProjectIconRegisteredFileId}}" - ] - } - }, - "response": [] - }, - { - "name": "ProjectIcon-UpdateProject-Same-ProjectIcon", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectName = pm.environment.get(\"projectNameUpdated\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"shortDescription\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"uri\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"role\": \"postmantest_ProjectIcon-CreateProject-Registered\"\r\n }\r\n ],\r\n \"fileId\": {{ProjectIconRegisteredFileId}},\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project/{{ProjectIconProjectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{ProjectIconProjectId}}" - ] - } - }, - "response": [] - }, - { - "name": "ProjectIcon-GetIcon-Registered-After-Edit", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.ok;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/file/{{ProjectIconRegisteredFileId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "file", - "{{ProjectIconRegisteredFileId}}" - ] - } - }, - "response": [] - }, - { - "name": "ProjectIcon-Post-New-File-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response includes fileId\", function () {\r", - " pm.expect(jsonData.id).to.exist;\r", - "})\r", - "\r", - "pm.environment.set(\"newRegisteredFileId\", jsonData.id);\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.success;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "File", - "type": "file", - "src": "Postman/testimage2.png" - } - ] - }, - "url": { - "raw": "{{apiUrl}}/api/File", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "File" - ] - } - }, - "response": [] - }, - { - "name": "ProjectIcon-UpdateProject-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectName = pm.environment.get(\"projectNameUpdated\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"shortDescription\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"uri\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_ProjectIcon-CreateProject-Registered\",\r\n \"role\": \"postmantest_ProjectIcon-CreateProject-Registered\"\r\n }\r\n ],\r\n \"fileId\": {{newRegisteredFileId}},\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project/{{ProjectIconProjectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{ProjectIconProjectId}}" - ] - } - }, - "response": [] - }, - { - "name": "ProjectIcon-GetUpdatedProject-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectName = pm.environment.get(\"projectName\");", - "var newRegisteredFileId = pm.environment.get(\"newRegisteredFileId\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});", - "", - "pm.test(\"ProjectIconId is set correctly and matches: \" + newRegisteredFileId, function () {", - " pm.expect(jsonData.projectIcon.id).to.eql(newRegisteredFileId)", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{ProjectIconProjectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{ProjectIconProjectId}}" - ] - } - }, - "response": [] - }, - { - "name": "ProjectIcon-GetDeletedIcon-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 404\", function () {\r", - " pm.response.to.have.status(404);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.notFound;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/file/{{ProjectIconRegisteredFileId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "file", - "{{ProjectIconRegisteredFileId}}" - ] - } - }, - "response": [] - }, - { - "name": "ProjectIcon-GetNewIcon-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.ok;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/file/{{newRegisteredFileId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "file", - "{{newRegisteredFileId}}" - ] - } - }, - "response": [] - }, - { - "name": "ProjectIcon-DeleteProject-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{ProjectIconProjectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{ProjectIconProjectId}}" - ] - } - }, - "response": [] - }, - { - "name": "ProjectIcon-GetNewIcon-Registered Copy", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 404\", function () {\r", - " pm.response.to.have.status(404);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.notFound;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/file/{{ProjectIconRegisteredFileId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "file", - "{{ProjectIconRegisteredFileId}}" - ] - } - }, - "response": [] - } - ], - "description": "Testing if the icons are accessible, and get deleted when they are supposed to ", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "CallToActionOption", - "item": [ - { - "name": "CallToActionOption-CreateCallToActionOption-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{registeredUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"type\": \"Title\",\n \"value\": \"Provide feedback\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-GetAllCallToActionOptions-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var optionId = parseInt(pm.environment.get(\"callToActionOptionId\"));", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findOption(jsonData, id) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].id == id) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Call to action option with id: \" + optionId + \" is in list\", function () {", - " foundAt = findOption(jsonData, optionId);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-GetCallToActionOptionById-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"callToActionOptionType\", jsonData.type);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Call to action option type is lowercase\", function () {", - " pm.expect(jsonData.type).to.eql(jsonData.type.toLowerCase());", - "});", - "", - "pm.test(\"Call to action option value is lowercase\", function () {", - " pm.expect(jsonData.value).to.eql(jsonData.value.toLowerCase());", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "value": "{{registeredUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-GetCallToActionOptionByType-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var callToActionOptionId = parseInt(pm.environment.get(\"callToActionOptionId\"));", - "", - "var jsonData = pm.response.json();", - "", - "function findOptionType(jsonData, id) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].id == id) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Call to action option id is \" + callToActionOptionId, function() {", - " foundAt = findOptionType(jsonData, callToActionOptionId);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/type/{{callToActionOptionType}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "type", - "{{callToActionOptionType}}" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-UpdateCallToActionOption-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "value": "{{registeredUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"type\": \"Updated type\",\r\n \"value\": \"Updated value\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-DeleteCallToActionOption-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "value": "{{registeredUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "File", - "item": [ - { - "name": "Get-Files-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "value": "{{registeredUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/File", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "File" - ] - } - }, - "response": [] - }, - { - "name": "Post-File-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "pm.environment.set(\"registeredFileId\", jsonData.id)\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.success;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{registeredUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "File", - "type": "file", - "src": "Postman/testimage.png" - } - ] - }, - "url": { - "raw": "{{apiUrl}}/api/File", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "File" - ] - } - }, - "response": [] - }, - { - "name": "Delete-File-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid\", function () {\r", - " pm.response.to.be.ok;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "value": "{{registeredUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/File/{{registeredFileId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "File", - "{{registeredFileId}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Cleanup Registered", - "item": [ - { - "name": "Project-DeleteProject-Self-Registered", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{registeredUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Cleanup Administrator", - "item": [ - { - "name": "CallToActionOption-DeleteCallToActionOption-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-DeleteProject-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{adminProjectId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-DeleteUser-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserId}}" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - } - ] - }, - { - "name": "Data Officer", - "item": [ - { - "name": "Preparation", - "item": [ - { - "name": "Institution-CreateInstitution", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var institutionName = pm.environment.get(\"institutionName\");", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"createdInstitutionId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Check if created Name matches: \" + institutionName, function () {", - " pm.expect(jsonData.name).to.eql(institutionName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"{{institutionName}}\",\n \"description\": \"postmantest_DataOfficer-Institution-CreateInstitution\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Institution", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Institution" - ] - } - }, - "response": [] - }, - { - "name": "User-CreateUserWithoutInstitution", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var userName = pm.environment.get(\"userName\");", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"createdUserId\", jsonData.id);", - "pm.environment.set(\"identityId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Check if created Username matches: \" + userName, function () {", - " pm.expect(jsonData.name).to.eql(userName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"9996\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_DataOfficer-User-CreateUserWithoutInstitution@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - }, - { - "name": "User-CreateUserWithInstitution", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var userName = pm.environment.get(\"userName\");", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"createdUserWithInstitutionId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Check if created Username matches: \" + userName, function () {", - " pm.expect(jsonData.name).to.eql(userName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"9996\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_DataOfficer-User-CreateUserWithInstitution@example.com\",\n \"institutionId\": {{institutionIdFromUser}}\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - }, - { - "name": "Project-CreateProject-DifferentInstitution", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", - "var projectName = pm.environment.get(\"projectName\");", - "var adminUserName = pm.environment.get(\"adminUserName\");", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"projectId\", jsonData.id);", - "pm.environment.set(\"adminProjectId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});", - "", - "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", - " pm.expect(jsonData.user.name).to.eql(adminUserName);", - "});", - "", - "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", - " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_DataOfficer-Project-CreateProject-DifferentInstitution\",\r\n \"shortDescription\": \"postmantest_DataOfficer-Project-CreateProject-DifferentInstitution\",\r\n \"uri\": \"postmantest_DataOfficer-Project-CreateProject-DifferentInstitution\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_DataOfficer-Project-CreateProject-DifferentInstitution\",\r\n \"role\": \"postmantest_DataOfficer-Project-CreateProject-DifferentInstitution\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "Project-CreateProject-SameInstitution", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"projectIdWithInstitution\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "\"9996\"" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_DataOfficer-Project-CreateProject-SameInstitution\",\r\n \"shortDescription\": \"postmantest_DataOfficer-Project-CreateProject-SameInstitution\",\r\n \"uri\": \"postmantest_DataOfficer-Project-CreateProject-SameInstitution\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_DataOfficer-Project-CreateProject-SameInstitution\",\r\n \"role\": \"postmantest_DataOfficer-Project-CreateProject-SameInstitution\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-CreateHighlight", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var identityId = parseInt(pm.environment.get(\"identityId\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"highlightId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", - "\r", - "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", - "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postmantest_DataOfficer-Highlight-CreateHighlight\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Highlight", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight" - ] - } - }, - "response": [] - }, - { - "name": "Embed-CreateEmbed-DifferentInstitution", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"embedGuid\", jsonData.guid);", - "pm.environment.set(\"adminEmbedGuid\", jsonData.guid);", - "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "Embed-CreateEmbed-SameInstitution", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"embedGuidWithInstitution\", jsonData.guid);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "\"9996\"" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectIdWithInstitution}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-CreateCallToActionOption", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"callToActionOptionId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Call to action option type is lowercase\", function () {", - " pm.expect(jsonData.type).to.eql(jsonData.type.toLowerCase());", - "});", - "", - "pm.test(\"Call to action option value is lowercase\", function () {", - " pm.expect(jsonData.value).to.eql(jsonData.value.toLowerCase());", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"type\": \"Title\",\r\n \"value\": \"Feedback\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption" - ] - } - }, - "response": [] - } - ], - "description": "For some requests, we need to have data available. The variables need to be filled so the request can succeed. We put these preparation requests in this folder. We will clean them up in the cleanup folder.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "User", - "item": [ - { - "name": "User-CreateUser-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\",\n \"institutionId\": {{createdInstitutionId}}\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - }, - { - "name": "User-UpdateUser-SelfWithSameInstitution-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if email update matches: \" + updatedAliceEmail, function () {", - " pm.expect(jsonData.email).to.eql(updatedAliceEmail);", - "});", - "", - "pm.test(\"Check if institution id is 1\", function () {", - " pm.expect(jsonData.institution.id).to.equal(1);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"postman_DataOfficer-alicez\",\r\n \"email\": \"{{updatedAliceEmail}}\",\r\n \"identityId\": \"{{dataOfficerUserIdentityId}}\",\r\n \"institutionId\": 1\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/{{dataOfficerUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{dataOfficerUserId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-UpdateUser-SelfWithWrongInstitution-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Instance guid should be: DD72C521-1D06-4E11-A0E0-AAE515E7F900\", function () {", - " pm.expect(jsonData.instance).to.equal(\"DD72C521-1D06-4E11-A0E0-AAE515E7F900\");", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"postman_DataOfficer-alicez\",\r\n \"email\": \"{{updatedAliceEmail}}\",\r\n \"identityId\": \"{{dataOfficerUserIdentityId}}\",\r\n \"institutionId\": {{createdInstitutionId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/{{dataOfficerUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{dataOfficerUserId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-UpdateUser-OtherWithSameInstitution-SameInstitutionId-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "var institutionId = pm.environment.get(\"institutionIdFromUser\");", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Institution Id is \" + institutionId, function() {", - " pm.expect(jsonData.institution.id).to.equal(parseInt(institutionId));", - "})" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"institutionId\": {{institutionIdFromUser}},\r\n \"identityId\": \"9996\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserWithInstitutionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserWithInstitutionId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-GetUser-Other-SameInstitution-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserWithInstitutionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserWithInstitutionId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-UpdateUser-OtherWithSameInstitution-NoInstitutionId-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if institution is null\", function () {", - " pm.expect(jsonData.institution).to.equal(null);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": \"9996\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserWithInstitutionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserWithInstitutionId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-UpdateUser-Other-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": \"9996\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserWithInstitutionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserWithInstitutionId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-GetUser-Other-DifferentInstitution-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-GetUser-Self-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var aliceIdentityId = parseInt(pm.environment.get(\"dataOfficerUserIdentityId\"));", - "", - "var jsonData = pm.response.json();", - "pm.environment.set(\"dataOfficerUserId\", jsonData.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Identity ID is correct and matching: \" + aliceIdentityId, function () {", - " pm.expect(parseInt(jsonData.identityId)).to.eql(aliceIdentityId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - } - ], - "description": "Requests executed as the Alice user with the registered role.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Project", - "item": [ - { - "name": "Project-CreateProject-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var registeredUserId = pm.environment.get(\"dataOfficerUserId\");", - "var projectName = pm.environment.get(\"projectName\");", - "", - "var jsonData = pm.response.json();", - "pm.environment.set(\"projectId\", jsonData.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});", - "", - "pm.test(\"Identity Id is set correctly and matches: \" + registeredUserId, function () {", - " pm.expect(jsonData.user.id).to.eql(registeredUserId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_Project-CreateProject-DataOfficer\",\r\n \"shortDescription\": \"postmantest_Project-CreateProject-DataOfficer\",\r\n \"uri\": \"postmantest_Project-CreateProject-DataOfficer\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Project-CreateProject-DataOfficer\",\r\n \"role\": \"postmantest_Project-CreateProject-DataOfficer\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "Project-GetAllProjects-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectName = pm.environment.get(\"projectName\");", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findProject(jsonData, name) {", - " for (var i = 0; i < jsonData.results.length; i++) {", - " if (jsonData.results[i].name == name) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project: \" + projectName + \" is in list\", function () {", - " foundAt = findProject(jsonData, projectName);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "", - "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "Project-GetProject-Self-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectName = pm.environment.get(\"projectName\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-GetProject-Other-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{adminProjectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-UpdateProject-Self-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectName = pm.environment.get(\"projectNameUpdated\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_Project-UpdateProject-Self-DataOfficer\",\r\n \"shortDescription\": \"postmantest_Project-UpdateProject-Self-DataOfficer\",\r\n \"uri\": \"postmantest_Project-UpdateProject-Self-DataOfficer\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Project-UpdateProject-Self-DataOfficer\",\r\n \"role\": \"postmantest_Project-UpdateProject-Self-DataOfficer\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-UpdateProject-Other-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{adminProjectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-LikeProject-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.ok;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "like", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-DeleteLikeProject-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.ok;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "like", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-DeleteProject-Other-OtherInstitution-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectToBeDeletedByUnauthorizedRoles}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectToBeDeletedByUnauthorizedRoles}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Embed", - "item": [ - { - "name": "Embed-CreateEmbed-Self-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"embedGuid\", jsonData.guid);", - "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "Embed-CreateEmbed-Other-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{adminProjectId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "Embed-GetAllEmbeds-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "Embed-GetEmbed-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Embed matches: \" + embeddedProjectId, function () {", - " pm.expect(jsonData.id).to.eql(embeddedProjectId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed", - "{{embedGuid}}" - ] - } - }, - "response": [] - }, - { - "name": "Embed-DeleteEmbed-Self-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed", - "{{embedGuid}}" - ] - } - }, - "response": [] - }, - { - "name": "Embed-DeleteEmbed-Other-DifferentInstitution-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed/{{adminEmbedGuid}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed", - "{{adminEmbedGuid}}" - ] - } - }, - "response": [] - }, - { - "name": "Embed-DeleteEmbed-Other-SameInstitution-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuidWithInstitution}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed", - "{{embedGuidWithInstitution}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Highlight", - "item": [ - { - "name": "Highlight-CreateHighlight-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", - "\r", - "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", - "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Highlight", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetAllActiveHighlights-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectId = pm.environment.get(\"adminProjectId\");", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findItem(jsonData, item) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].projectId == item) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Highlight is in list and matching: \" + projectId, function () {", - " foundAt = findItem(jsonData, projectId);", - " pm.expect(foundAt).to.not.eql(-1);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetHighlight-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var identityId = parseInt(pm.environment.get(\"identityId\"));", - "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", - "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Highlight Id matches: \" + highlightId, function () {", - " pm.expect(jsonData.id).to.eql(highlightId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{highlightId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetHighlight-ByProject-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-UpdateHighlight-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "value": "{{dataOfficerUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{highlightEndDate}}\",\r\n \"description\" : \"Lorem Ipsum\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{highlightId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-DeleteHighlight-Other-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{highlightId}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Role", - "item": [ - { - "name": "Role-CreateRole-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Role", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role" - ] - } - }, - "response": [] - }, - { - "name": "Role-GetAllRoles-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role" - ] - } - }, - "response": [] - }, - { - "name": "Scope-GetAllScopes-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role/Scopes", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "Scopes" - ] - } - }, - "response": [] - }, - { - "name": "Role-GetRole-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "{{roleId}}" - ] - } - }, - "response": [] - }, - { - "name": "Role-UpdateRole-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "{{roleId}}" - ] - } - }, - "response": [] - }, - { - "name": "Role-SetRole-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"createdUserId\": {{createdUserId}},\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId={{roleId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "setRole" - ], - "query": [ - { - "key": "createdUserId", - "value": "{{createdUserId}}", - "description": "Id of the user that we want to update" - }, - { - "key": "roleId", - "value": "{{roleId}}", - "description": "Id of the role that you want to update the user with" - } - ] - } - }, - "response": [] - }, - { - "name": "Role-DeleteRole-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "{{roleId}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Search", - "item": [ - { - "name": "Search-SearchInternal-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Search/internal/{{projectName}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Search", - "internal", - "{{projectName}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Wizard", - "item": [] - }, - { - "name": "Institution", - "item": [ - { - "name": "Institution-CreateInstitution-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - }, - { - "name": "Institution-GetInstitution-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/User/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "1" - ] - } - }, - "response": [] - }, - { - "name": "Institution-UpdateInstitution-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "1" - ] - } - }, - "response": [] - }, - { - "name": "Instituiton-DeleteInstitution-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/User/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "1" - ] - } - }, - "response": [] - } - ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "CallToActionOption", - "item": [ - { - "name": "CallToActionOption-CreateCallToActionOption-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{dataOfficerUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"type\": \"Title\",\n \"value\": \"Provide feedback\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-GetAllCallToActionOptions-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var optionId = parseInt(pm.environment.get(\"callToActionOptionId\"));", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findOption(jsonData, id) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].id == id) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Call to action option with id: \" + optionId + \" is in list\", function () {", - " foundAt = findOption(jsonData, optionId);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-GetCallToActionOptionById-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"callToActionOptionType\", jsonData.type);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Call to action option type is lowercase\", function () {", - " pm.expect(jsonData.type).to.eql(jsonData.type.toLowerCase());", - "});", - "", - "pm.test(\"Call to action option value is lowercase\", function () {", - " pm.expect(jsonData.value).to.eql(jsonData.value.toLowerCase());", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "value": "{{dataOfficerUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-GetCallToActionOptionByType-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var callToActionOptionId = parseInt(pm.environment.get(\"callToActionOptionId\"));", - "", - "var jsonData = pm.response.json();", - "", - "function findOptionType(jsonData, id) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].id == id) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Call to action option id is \" + callToActionOptionId, function() {", - " foundAt = findOptionType(jsonData, callToActionOptionId);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/type/{{callToActionOptionType}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "type", - "{{callToActionOptionType}}" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-UpdateCallToActionOption-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "value": "{{dataOfficerUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"type\": \"Updated type\",\r\n \"value\": \"Updated value\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-DeleteCallToActionOption-DataOffficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "value": "{{dataOfficerUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "File", - "item": [ - { - "name": "Post-File-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "pm.environment.set(\"dataOfficerFileId\", jsonData.id)\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{dataOfficerUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "File", - "type": "file", - "src": "Postman/testimage.png" - } - ] - }, - "url": { - "raw": "{{apiUrl}}/api/File", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "File" - ] - } - }, - "response": [] - }, - { - "name": "Get-Files-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "value": "{{dataOfficerUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/File", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "File" - ] - } - }, - "response": [] - }, - { - "name": "Delete-File-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid\", function () {\r", - " pm.response.to.be.ok;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/File/{{dataOfficerFileId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "File", - "{{dataOfficerFileId}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Cleanup Data Officer", - "item": [ - { - "name": "Project-DeleteProject-Self-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-DeleteProject-Other-SameInstitution-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectIdWithInstitution}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectIdWithInstitution}}" - ] - } - }, - "response": [] - }, - { - "name": "User-UpdateUser-SelfWithNoInstitution-DataOfficer", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var updatedAliceEmail = pm.environment.get(\"updatedAliceEmail\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if email update matches: \" + updatedAliceEmail, function () {", - " pm.expect(jsonData.email).to.eql(updatedAliceEmail);", - "});", - "", - "pm.test(\"Check if institution is null\", function () {", - " pm.expect(jsonData.institution).to.equal(null);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{dataOfficerUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"postman_DataOfficer-alicez\",\r\n \"email\": \"{{updatedAliceEmail}}\",\r\n \"identityId\": \"{{dataOfficerUserIdentityId}}\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/{{dataOfficerUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{dataOfficerUserId}}" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Cleanup Administrator", - "item": [ - { - "name": "CallToActionOption-DeleteCallToActionOption-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-DeleteProject-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{adminProjectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Institution-DeleteInstitution-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Institution/{{createdInstitutionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Institution", - "{{createdInstitutionId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-DeleteUser-Other-SameInstitution-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserWithInstitutionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserWithInstitutionId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-DeleteUser-Other-DifferentInstitution-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserId}}" - ] - } - }, - "response": [] - } - ] - } - ] - }, - { - "name": "PR", - "item": [ - { - "name": "Preparation", - "item": [ - { - "name": "User-CreateUser", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var userName = pm.environment.get(\"userName\");", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"createdUserId\", jsonData.id);", - "pm.environment.set(\"identityId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Check if created Username matches: \" + userName, function () {", - " pm.expect(jsonData.name).to.eql(userName);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"99966\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_PR-User-CreateUser@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - }, - { - "name": "Project-CreateProject", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var administratorUserId = parseInt(pm.environment.get(\"administratorUserId\"));", - "var projectName = pm.environment.get(\"projectName\");", - "var adminUserName = pm.environment.get(\"adminUserName\");", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"projectId\", jsonData.id);", - "pm.environment.set(\"adminProjectId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});", - "", - "pm.test(\"User Name is correct and matching: \" + adminUserName, function () {", - " pm.expect(jsonData.user.name).to.eql(adminUserName);", - "});", - "", - "pm.test(\"Identity ID is correct and matching: \" + administratorUserId, function () {", - " pm.expect(parseInt(jsonData.user.id)).to.eql(administratorUserId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_PR-Project-CreateProject\",\r\n \"shortDescription\": \"postmantest_PR-Project-CreateProject\",\r\n \"uri\": \"postmantest_PR-Project-CreateProject\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_PR-Project-CreateProject\",\r\n \"role\": \"postmantest_PR-Project-CreateProject\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-CreateHighlight", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "var identityId = parseInt(pm.environment.get(\"identityId\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"highlightId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", - "\r", - "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", - "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postmantest_PR-Highlight-CreateHighlight\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Highlight", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight" - ] - } - }, - "response": [] - }, - { - "name": "Embed-CreateEmbed", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"embedGuid\", jsonData.guid);", - "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-CreateCallToActionOption", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"callToActionOptionId\", jsonData.id);", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Call to action option type is lowercase\", function () {", - " pm.expect(jsonData.type).to.eql(jsonData.type.toLowerCase());", - "});", - "", - "pm.test(\"Call to action option value is lowercase\", function () {", - " pm.expect(jsonData.value).to.eql(jsonData.value.toLowerCase());", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"type\": \"Title\",\r\n \"value\": \"Feedback\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption" - ] - } - }, - "response": [] - } - ], - "description": "For some requests, we need to have data available. The variables need to be filled so the request can succeed. We put these preparation requests in this folder. We will clean them up in the cleanup folder.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "User", - "item": [ - { - "name": "User-CreateUser-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"{{createdUserId}}\",\n \"name\": \"{{userName}}\",\n \"email\": \"postmantest_email@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - }, - { - "name": "User-GetUser-Other-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-GetUser-Self-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var prUserIdentityId = parseInt(pm.environment.get(\"prUserIdentityId\"));", - "", - "var jsonData = pm.response.json();", - "pm.environment.set(\"PrUserId\", jsonData.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Identity ID is correct and matching: \" + prUserIdentityId, function () {", - " pm.expect(parseInt(jsonData.identityId)).to.eql(prUserIdentityId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - }, - { - "name": "User-UpdateUser-Self-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var updatedPrUserEmail = pm.environment.get(\"updatedPrUserEmail\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if email update matches: \" + updatedPrUserEmail, function () {", - " pm.expect(jsonData.email).to.eql(updatedPrUserEmail);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "value": "{{prUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"postman_Pr_jerry\",\r\n \"email\": \"{{updatedPrUserEmail}}\",\r\n \"identityId\": \"{{prUserIdentityId}}\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/{{PrUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{PrUserId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-UpdateUser-Other-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserId}}" - ] - } - }, - "response": [] - } - ], - "description": "Requests executed as the Alice user with the registered role.", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "FollowUser", - "item": [ - { - "name": "User-FollowUser-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "var userId = pm.environment.get(\"userIdToFollow\");", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if created Username matches: \" + userId, function () {", - " pm.expect(jsonData.id).to.eql(userId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "follow", - "{{userIdToFollow}}" - ] - } - }, - "response": [] - }, - { - "name": "User-UnFollowUser-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/follow/{{userIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "follow", - "{{userIdToFollow}}" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Project", - "item": [ - { - "name": "Project-CreateProject-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var PrUserId = pm.environment.get(\"PrUserId\");", - "var projectName = pm.environment.get(\"projectName\");", - "", - "var jsonData = pm.response.json();", - "pm.environment.set(\"projectId\", jsonData.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});", - "", - "pm.test(\"User Id is set correctly and matches: \" + PrUserId, function () {", - " pm.expect(jsonData.user.id).to.eql(PrUserId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{prUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectName}}\",\r\n \"description\": \"postmantest_Project-CreateProject-PR\",\r\n \"shortDescription\": \"postmantest_Project-CreateProject-PR\",\r\n \"uri\": \"postmantest_Project-CreateProject-PR\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Project-CreateProject-PR\",\r\n \"role\": \"postmantest_Project-CreateProject-PR\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "Project-GetAllProjects-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectName = pm.environment.get(\"projectName\");", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findProject(jsonData, name) {", - " for (var i = 0; i < jsonData.results.length; i++) {", - " if (jsonData.results[i].name == name) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project: \" + projectName + \" is in list\", function () {", - " foundAt = findProject(jsonData, projectName);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "", - "pm.test(\"Project Name is set correctly and matching: \" + projectName, function () {", - " pm.expect(jsonData.results[foundAt].name).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project" - ] - } - }, - "response": [] - }, - { - "name": "Project-GetProject-Self-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectName = pm.environment.get(\"projectName\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-GetProject-Other-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{adminProjectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-UpdateProject-Self-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectName = pm.environment.get(\"projectNameUpdated\");", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project Name is set correctly and matches: \" + projectName, function () {", - " pm.expect(jsonData.name).to.eql(projectName);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_Project-CreateProject-PR\",\r\n \"shortDescription\": \"postmantest_Project-CreateProject-PR\",\r\n \"uri\": \"postmantest_Project-CreateProject-PR\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_Project-CreateProject-PR\",\r\n \"role\": \"postmantest_Project-CreateProject-PR\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-UpdateProject-Other-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{adminProjectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-LikeProject-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.ok;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "like", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-DeleteLikeProject-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.ok;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/like/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "like", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-DeleteProject-Other-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{adminProjectId}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "FollowProject", - "item": [ - { - "name": "Project-FollowProject-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "var projectId = pm.environment.get(\"projectIdToFollow\");", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Check if created project id matches: \" + projectId, function () {", - " pm.expect(jsonData.id).to.eql(projectId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "project", - "follow", - "{{projectIdToFollow}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-UnFollowProject-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/project/follow/{{projectIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "project", - "follow", - "{{projectIdToFollow}}" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "Embed", - "item": [ - { - "name": "Embed-CreateEmbed-Self-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"embedGuid\", jsonData.guid);", - "pm.environment.set(\"embeddedProjectId\", jsonData.project.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{prUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "Embed-CreateEmbed-Other-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"otherEmbedGuid\", jsonData.guid);", - "pm.environment.set(\"otherEmbeddedProjectId\", jsonData.project.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{prUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{adminProjectId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "Embed-GetAllEmbeds-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "value": "{{prUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed" - ] - } - }, - "response": [] - }, - { - "name": "Embed-GetEmbed-Self-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var embeddedProjectId = parseInt(pm.environment.get(\"embeddedProjectId\"))", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Embed matches: \" + embeddedProjectId, function () {", - " pm.expect(jsonData.id).to.eql(embeddedProjectId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed", - "{{embedGuid}}" - ] - } - }, - "response": [] - }, - { - "name": "Embed-GetEmbed-Other-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var otherEmbeddedProjectId = parseInt(pm.environment.get(\"otherEmbeddedProjectId\"))", - "", - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Embed matches: \" + otherEmbeddedProjectId, function () {", - " pm.expect(jsonData.id).to.eql(otherEmbeddedProjectId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed/{{otherEmbedGuid}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed", - "{{otherEmbedGuid}}" - ] - } - }, - "response": [] - }, - { - "name": "Embed-DeleteEmbed-Self-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed/{{embedGuid}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed", - "{{embedGuid}}" - ] - } - }, - "response": [] - }, - { - "name": "Embed-DeleteEmbed-Other-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Embed/{{otherEmbedGuid}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Embed", - "{{otherEmbedGuid}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Highlight", - "item": [ - { - "name": "Highlight-CreateHighlight-Self-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"highlightId\", jsonData.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", - "\r", - "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", - "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{projectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postman_Highlight-CreateHighlight-Self-PR\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Highlight", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetHighlight-Self-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var identityId = parseInt(pm.environment.get(\"identityId\"));", - "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", - "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Highlight Id matches: \" + highlightId, function () {", - " pm.expect(jsonData.id).to.eql(highlightId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "value": "{{prUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{highlightId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetHighlight-ByProject-Self-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var identityId = parseInt(pm.environment.get(\"identityId\"));", - "var projectId = parseInt(pm.environment.get(\"projectId\"));", - "var highlightId = parseInt(pm.environment.get(\"highlightId\"));", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findHighlightId(jsonData, item) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].id == item) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "function findProjectId(jsonData, item) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].projectId == item) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project is in list and matching: \" + projectId, function () {", - " foundAt = findProjectId(jsonData, projectId);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "", - "pm.test(\"Highlight is in list and matching:\" + highlightId, function () {", - " foundAt = findHighlightId(jsonData, highlightId);", - " pm.expect(foundAt).to.not.eql(-1);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-UpdateHighlight-Self-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "value": "{{prUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postman_Highlight-CreateHighlight-Self-PR\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{highlightId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-CreateHighlight-Other-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "pm.environment.set(\"adminHighlightId\", jsonData.id);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 201\", function () {", - " pm.response.to.have.status(201);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.success;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());\r", - "\r", - "var future_timestamp = new Date(Date.now() +(2 * 86400000));\r", - "postman.setEnvironmentVariable(\"future_timestamp\", future_timestamp.toISOString());\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": {{adminProjectId}},\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postman_Highlight-CreateHighlight-Other-PR\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Highlight", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetHighlight-Other-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var identityId = parseInt(pm.environment.get(\"identityId\"));", - "var adminHighlightId = parseInt(pm.environment.get(\"adminHighlightId\"));", - "", - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"highlightStartDate\", jsonData.startDate);", - "pm.environment.set(\"highlightEndDate\", jsonData.endDate);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Highlight Id matches: \" + adminHighlightId, function () {", - " pm.expect(jsonData.id).to.eql(adminHighlightId);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{adminHighlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{adminHighlightId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetHighlight-ByProject-Other-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var identityId = parseInt(pm.environment.get(\"identityId\"));", - "var adminProjectId = parseInt(pm.environment.get(\"adminProjectId\"));", - "var adminHighlightId = parseInt(pm.environment.get(\"adminHighlightId\"));", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findHighlightId(jsonData, item) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].id == item) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "function findProjectId(jsonData, item) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].projectId == item) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Project is in list and matching: \" + adminProjectId, function () {", - " foundAt = findProjectId(jsonData, adminProjectId);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "", - "pm.test(\"Highlight is in list and matching:\" + adminHighlightId, function () {", - " foundAt = findHighlightId(jsonData, adminHighlightId);", - " pm.expect(foundAt).to.not.eql(-1);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight/Project/{{adminProjectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "Project", - "{{adminProjectId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-UpdateHighlight-Other-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "var current_timestamp = new Date();\r", - "postman.setEnvironmentVariable(\"current_timestamp\", current_timestamp.toISOString());" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"projectId\": \"{{projectId}}\",\r\n \"startDate\": \"{{current_timestamp}}\",\r\n \"endDate\": \"{{future_timestamp}}\",\r\n \"description\" : \"postman_Highlight-CreateHighlight-Other-PR\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{adminHighlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{adminHighlightId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-GetAllActiveHighlights-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var projectId = pm.environment.get(\"adminProjectId\");", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findItem(jsonData, item) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].projectId == item) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Highlight is in list and matching: \" + projectId, function () {", - " foundAt = findItem(jsonData, projectId);", - " pm.expect(foundAt).to.not.eql(-1);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-DeleteHighlight-Self-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{highlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{highlightId}}" - ] - } - }, - "response": [] - }, - { - "name": "Highlight-DeleteHighlight-Other-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Highlight/{{adminHighlightId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Highlight", - "{{adminHighlightId}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Role", - "item": [ - { - "name": "Role-CreateRole-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{roleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Role", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role" - ] - } - }, - "response": [] - }, - { - "name": "Role-GetAllRoles-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role" - ] - } - }, - "response": [] - }, - { - "name": "Scope-GetAllScopes-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role/Scopes", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "Scopes" - ] - } - }, - "response": [] - }, - { - "name": "Role-GetRole-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "{{roleId}}" - ] - } - }, - "response": [] - }, - { - "name": "Role-UpdateRole-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"{{updatedRoleName}}\",\r\n \"scopes\": [\r\n {\r\n \"scope\": \"EmbedWrite\"\r\n }\r\n ]\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "{{roleId}}" - ] - } - }, - "response": [] - }, - { - "name": "Role-SetRole-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"createdUserId\": {{createdUserId}},\r\n \"name\": \"{{projectNameUpdated}}\",\r\n \"description\": \"postmantest_description\",\r\n \"shortDescription\": \"postmantest_shortdesc\",\r\n \"uri\": \"postmantest_uri\",\r\n \"collaborators\": [\r\n {\r\n \"fullName\": \"postmantest_collfullname\",\r\n \"role\": \"postmantest_collrole\"\r\n }\r\n ],\r\n \"created\": \"2020-04-20T08:24:26.693Z\",\r\n \"updated\": \"2020-04-20T08:24:26.693Z\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/Role/setRole?createdUserId={{createdUserId}}&roleId={{roleId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "setRole" - ], - "query": [ - { - "key": "createdUserId", - "value": "{{createdUserId}}", - "description": "Id of the user that we want to update" - }, - { - "key": "roleId", - "value": "{{roleId}}", - "description": "Id of the role that you want to update the user with" - } - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Search", - "item": [ - { - "name": "Search-SearchInternal-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Search/internal/{{projectName}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Search", - "internal", - "{{projectName}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Wizard", - "item": [] - }, - { - "name": "Institution", - "item": [ - { - "name": "Institution-CreateInstitution-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\t\"identityId\": \"98764342123\",\n \"name\": \"mycooltestusername\",\n \"email\": \"postmantest_email@example.com\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User" - ] - } - }, - "response": [] - }, - { - "name": "Institution-GetInstitution-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/User/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "1" - ] - } - }, - "response": [] - }, - { - "name": "Institution-UpdateInstitution-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"name\": \"bobz\",\r\n \"email\": \"BobSmith@email.com\",\r\n \"identityId\": {{administratorUserIdentityId}}\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "1" - ] - } - }, - "response": [] - }, - { - "name": "Instituiton-DeleteInstitution-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 401\", function () {", - " pm.response.to.have.status(401);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.unauthorized;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{apiUrl}}/api/User/1", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "1" - ] - } - }, - "response": [] - } - ], - "auth": { - "type": "noauth" - }, - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "CallToActionOption", - "item": [ - { - "name": "CallToActionOption-CreateCallToActionOption-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{prUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"type\": \"Title\",\n \"value\": \"Provide feedback\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-GetAllCallToActionOptions-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var optionId = parseInt(pm.environment.get(\"callToActionOptionId\"));", - "", - "var jsonData = pm.response.json();", - "", - "var foundAt;", - "", - "function findOption(jsonData, id) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].id == id) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Call to action option with id: \" + optionId + \" is in list\", function () {", - " foundAt = findOption(jsonData, optionId);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-GetCallToActionOptionById-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "pm.environment.set(\"callToActionOptionType\", jsonData.type);", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Call to action option type is lowercase\", function () {", - " pm.expect(jsonData.type).to.eql(jsonData.type.toLowerCase());", - "});", - "", - "pm.test(\"Call to action option value is lowercase\", function () {", - " pm.expect(jsonData.value).to.eql(jsonData.value.toLowerCase());", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "value": "{{prUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-GetCallToActionOptionByType-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var callToActionOptionId = parseInt(pm.environment.get(\"callToActionOptionId\"));", - "", - "var jsonData = pm.response.json();", - "", - "function findOptionType(jsonData, id) {", - " for (var i = 0; i < jsonData.length; i++) {", - " if (jsonData[i].id == id) {", - " return i;", - " }", - " }", - " return -1;", - "}", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.ok;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});", - "", - "pm.test(\"Call to action option id is \" + callToActionOptionId, function() {", - " foundAt = findOptionType(jsonData, callToActionOptionId);", - " pm.expect(foundAt).to.not.eql(-1);", - "});", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/type/{{callToActionOptionType}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "type", - "{{callToActionOptionType}}" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-UpdateCallToActionOption-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "IdentityId", - "value": "{{prUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"type\": \"Updated type\",\r\n \"value\": \"Updated value\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - }, - { - "name": "CallToActionOption-DeleteCallToActionOption-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();", - "", - "eval(pm.environment.get(\"commonTests\"))();", - "", - "pm.test(\"Status code is 403\", function () {", - " pm.response.to.have.status(403);", - "});", - "", - "pm.test(\"Response must be valid and have a json body\", function () {", - " pm.response.to.be.forbidden;", - " pm.response.to.be.withBody;", - " pm.response.to.be.json;", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "value": "{{prUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] - }, - { - "name": "File", - "item": [ - { - "name": "Post-File-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonData = pm.response.json();\r", - "\r", - "pm.environment.set(\"prFileId\", jsonData.id)\r", - "\r", - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.success;\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "IdentityId", - "value": "{{prUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "File", - "type": "file", - "src": "Postman/testimage.png" - } - ] - }, - "url": { - "raw": "{{apiUrl}}/api/File", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "File" - ] - } - }, - "response": [] - }, - { - "name": "Get-Files-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid and have a json body\", function () {\r", - " pm.response.to.be.withBody;\r", - " pm.response.to.be.json;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "IdentityId", - "value": "{{prUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/File", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "File" - ] - } - }, - "response": [] - }, - { - "name": "Delete-File-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "eval(pm.environment.get(\"commonTests\"))();\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response must be valid\", function () {\r", - " pm.response.to.be.ok;\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "value": "{{prUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/File/{{prFileId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "File", - "{{prFileId}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Cleanup PR", - "item": [ - { - "name": "Project-DeleteProject-PR", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{prUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectId}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Cleanup Administrator", - "item": [ - { - "name": "CallToActionOption-DeleteCallToActionOption-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/CallToActionOption/{{callToActionOptionId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "CallToActionOption", - "{{callToActionOptionId}}" - ] - } - }, - "response": [] - }, - { - "name": "Project-DeleteProject-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{adminProjectId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{adminProjectId}}" - ] - } - }, - "response": [] - }, - { - "name": "User-DeleteUser-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/{{createdUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{createdUserId}}" - ] - } - }, - "response": [] - } - ] - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/Postman/dex-cleanup.postman_collection.json b/Postman/dex-cleanup.postman_collection.json deleted file mode 100644 index e0aa023c..00000000 --- a/Postman/dex-cleanup.postman_collection.json +++ /dev/null @@ -1,391 +0,0 @@ -{ - "info": { - "_postman_id": "dff4ba06-7393-4f76-831c-2c57b0971548", - "name": "DEV-Cleanup", - "description": "Testing Digital Excellence API", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "Cleanup", - "item": [ - { - "name": "DeleteUsers", - "item": [ - { - "name": "Registered", - "item": [ - { - "name": "Delete-RegisteredUser", - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{apiUrl}}/api/User/{{registeredUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{registeredUserId}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "PR", - "item": [ - { - "name": "Delete-PRUser", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/{{prUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{prUserId}}" - ] - } - }, - "response": [] - } - ] - }, - { - "name": "DataOfficer", - "item": [ - { - "name": "Delete-DataOfficerUser", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/{{dataOfficerUserId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{dataOfficerUserId}}" - ] - } - }, - "response": [] - } - ] - } - ] - }, - { - "name": "Delete-ProjectForFollowing", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectIdToFollow}}" - ] - } - }, - "response": [] - }, - { - "name": "Delete-ProjectToBeDeletedByUnauthorizedRole", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Project/{{projectToBeDeletedByUnauthorizedRoles}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Project", - "{{projectToBeDeletedByUnauthorizedRoles}}" - ] - } - }, - "response": [] - }, - { - "name": "Delete-UserForFollowing", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));\r", - "\r", - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {\r", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "value": "{{administratorUserIdentityId}}", - "type": "text" - } - ], - "url": { - "raw": "{{apiUrl}}/api/User/{{userIdToFollow}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "User", - "{{userIdToFollow}}" - ] - } - }, - "response": [] - }, - { - "name": "Role-DeleteRole-Administrator", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var responseTimeThreshold = parseInt(pm.environment.get(\"responseTimeThreshold\"));", - "", - "pm.test(\"Status code is 200\", function () {", - " pm.response.to.have.status(200);", - "});", - "", - "pm.test(\"Response time is less than \" + responseTimeThreshold + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(responseTimeThreshold);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "IdentityId", - "type": "text", - "value": "{{administratorUserIdentityId}}" - } - ], - "url": { - "raw": "{{apiUrl}}/api/Role/{{roleId}}", - "host": [ - "{{apiUrl}}" - ], - "path": [ - "api", - "Role", - "{{roleId}}" - ] - } - }, - "response": [] - } - ] - } - ], - "auth": { - "type": "oauth2", - "oauth2": [ - { - "key": "accessToken", - "value": "{{accessToken}}", - "type": "string" - }, - { - "key": "tokenType", - "value": "Bearer", - "type": "string" - }, - { - "key": "addTokenTo", - "value": "header", - "type": "string" - } - ] - }, - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "// Adapted from: https://gist.github.com/harryi3t/dd5c61451206047db70710ff6174c3c1", - "", - "let tokenUrl = pm.variables.get(\"tokenUrl\");", - "let clientId = pm.variables.get(\"clientId\");", - "let clientSecret = pm.variables.get(\"clientSecret\");", - "let scope = pm.variables.get(\"scope\");", - "", - "let getTokenRequest = {", - " method: 'POST',", - " url: tokenUrl,", - " auth: {", - " type: \"basic\",", - " basic: [", - " { key: \"username\", value: clientId },", - " { key: \"password\", value: clientSecret }", - " ]", - " },", - " body: {", - " mode: 'formdata',", - " formdata: [", - " { key: 'grant_type', value: 'client_credentials' },", - " { key: 'scope', value: scope }", - " ]", - " }", - "};", - "", - "pm.sendRequest(getTokenRequest, (err, response) => {", - " let jsonResponse = response.json(),", - " newAccessToken = jsonResponse.access_token;", - "", - " console.log({ err, jsonResponse, newAccessToken })", - "", - " pm.environment.set('accessToken', newAccessToken);", - " pm.variables.set('accessToken', newAccessToken);", - "});" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ] -} \ No newline at end of file From d54101ecabd51c354d2e8867d3e9b0d28e27d848 Mon Sep 17 00:00:00 2001 From: Zarthenix Date: Fri, 23 Apr 2021 11:47:42 +0200 Subject: [PATCH 05/19] Seed update --- API/HelperClasses/SeedHelper.cs | 36 +++++++++++++++++++++++---------- API/Startup.cs | 9 +++++++++ 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/API/HelperClasses/SeedHelper.cs b/API/HelperClasses/SeedHelper.cs index 2925fb65..64f7c0a9 100644 --- a/API/HelperClasses/SeedHelper.cs +++ b/API/HelperClasses/SeedHelper.cs @@ -63,22 +63,36 @@ public static List FindRoleScopesNotInDb(List seededRoleSc /// /// /// - public static void InsertUser(User seedUser, ApplicationDbContext context) + public static void InsertUsers(List seedUsers, ApplicationDbContext context) { - List usersInDb = context.User.AsQueryable() + foreach(User seedUser in seedUsers) + { + List usersInDb = context.User.AsQueryable() .Include(e => e.Role) .ToList(); - if(usersInDb.Find(e => e.IdentityId == seedUser.IdentityId) != null) - { - User foundEntity = usersInDb.Find(e => e.IdentityId == seedUser.IdentityId); - foundEntity.Role = seedUser.Role; - context.Update(foundEntity); - context.SaveChanges(); - return; + if(usersInDb.Find(e => e.IdentityId == seedUser.IdentityId) != null) + { + User foundEntity = usersInDb.Find(e => e.IdentityId == seedUser.IdentityId); + foundEntity.Role = seedUser.Role; + context.Update(foundEntity); + context.SaveChanges(); + return; + } + if(usersInDb.Find(e => e.Name == seedUser.Name) != null || usersInDb.Find(e => e.Email == seedUser.Email) != null) + { + + User foundEntity = usersInDb.Find(e => e.Name == seedUser.Name || e.Email == seedUser.Email); + foundEntity.Role = seedUser.Role; + foundEntity.IdentityId = seedUser.IdentityId; + foundEntity.Name = seedUser.Name; + foundEntity.Email = seedUser.Email; + context.Update(foundEntity); + context.SaveChanges(); + return; + } + context.User.Add(seedUser); } - - context.User.Add(seedUser); context.SaveChanges(); } diff --git a/API/Startup.cs b/API/Startup.cs index 1fcb13a8..e7825e13 100644 --- a/API/Startup.cs +++ b/API/Startup.cs @@ -466,6 +466,15 @@ private static void UpdateDatabase(IApplicationBuilder app, IWebHostEnvironment SeedHelper.InsertRoles(Seed.SeedRoles(), context); List roles = context.Role.ToList(); + //SeedHelper.InsertUsers(new List + // { + // Seed.SeedPrUser(roles), + // Seed.SeedAdminUser(roles), + // Seed.SeedDataOfficerUser(roles), + // Seed.SeedAlumniUser(roles) + // }, context); + + if(!env.IsProduction()) { if(!context.Institution.Any()) From 86d3bcb2284b79c40d57ebc86c8858f20feab217 Mon Sep 17 00:00:00 2001 From: Zarthenix Date: Wed, 12 May 2021 11:59:57 +0200 Subject: [PATCH 06/19] First iteration comment-system Added retrieval of comments, post yet to add --- API/Configuration/MappingProfile.cs | 4 ++ API/Controllers/ProjectController.cs | 63 ++++++++++++++++++- .../DependencyInjectionExtensions.cs | 3 + API/Resources/ProjectCommentResource.cs | 23 +++++++ API/Resources/ProjectCommentResourceResult.cs | 24 +++++++ Data/ApplicationDbContext.cs | 16 +++++ Models/ProjectComment.cs | 27 ++++++++ Models/ProjectCommentLike.cs | 29 +++++++++ Repositories/ProjectCommentRepository.cs | 33 ++++++++++ Services/Services/ProjectCommentService.cs | 29 +++++++++ 10 files changed, 250 insertions(+), 1 deletion(-) create mode 100644 API/Resources/ProjectCommentResource.cs create mode 100644 API/Resources/ProjectCommentResourceResult.cs create mode 100644 Models/ProjectComment.cs create mode 100644 Models/ProjectCommentLike.cs create mode 100644 Repositories/ProjectCommentRepository.cs create mode 100644 Services/Services/ProjectCommentService.cs diff --git a/API/Configuration/MappingProfile.cs b/API/Configuration/MappingProfile.cs index b1d64576..f1190175 100644 --- a/API/Configuration/MappingProfile.cs +++ b/API/Configuration/MappingProfile.cs @@ -112,6 +112,10 @@ public MappingProfile() .ForMember(q => q.Id, opt => opt.MapFrom(q=> q.Category.Id)) .ForMember(q => q.Name, opt => opt.MapFrom(q => q.Category.Name)); + CreateMap(); + CreateMap(); + + CreateMap(); CreateMap(); diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index be37a42d..50d7fc01 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -56,6 +56,7 @@ public class ProjectController : ControllerBase private readonly IProjectService projectService; private readonly IProjectCategoryService projectCategoryService; private readonly ICategoryService categoryService; + private readonly IProjectCommentService projectCommentService; private readonly IUserProjectLikeService userProjectLikeService; private readonly IUserProjectService userProjectService; private readonly IUserService userService; @@ -84,6 +85,7 @@ public class ProjectController : ControllerBase /// The call to action option service is used to communicate with the logic layer. /// The category service is used to work with categories /// The project category service is used to connect projects and categories + /// /// The projectinstitution service is responsible for link projects and institutions. /// The institution service which is used to communicate with the logic layer public ProjectController(IProjectService projectService, @@ -98,7 +100,8 @@ public ProjectController(IProjectService projectService, IInstitutionService institutionService, ICallToActionOptionService callToActionOptionService, ICategoryService categoryService, - IProjectCategoryService projectCategoryService) + IProjectCategoryService projectCategoryService, + IProjectCommentService projectCommentService) { this.projectService = projectService; this.userService = userService; @@ -113,6 +116,7 @@ public ProjectController(IProjectService projectService, this.projectCategoryService = projectCategoryService; this.projectInstitutionService = projectInstitutionService; this.institutionService = institutionService; + this.projectCommentService = projectCommentService; } @@ -1339,6 +1343,63 @@ await projectCategoryService.RemoveAsync(alreadyCategorized.Id) return Ok(mapper.Map(project)); } + + /// + /// Gets the comments belonging to the provided project-id. + /// + /// The project-id for which to retrieve the comments. + /// + [HttpGet("comments/{projectId}")] + [AllowAnonymous] + [ProducesResponseType(typeof(List), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)] + public async Task GetCommentsAsync(int projectId) + { + if(projectId < 0) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting comments", + Detail = + "The projectId is smaller than 0 and therefore it could never retrieve comments.", + Instance = "" + }; + return BadRequest(problem); + } + + List comments = await projectCommentService.GetProjectComments(projectId); + + if(comments == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed getting comments", + Detail = "The comments could not be found in the database.", + Instance = "" + + }; + return NotFound(problem); + } + + return Ok(mapper.Map, List>(comments)); + } + + /// + /// Post a new comment to the provided project-id + /// + /// The project-id to add the new comment to + /// The added comment and its metadata + /// + [HttpPost("comment/{projectId}")] + [Authorize] + [ProducesResponseType(typeof(ProjectCommentResourceResult), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status401Unauthorized)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)] + public async Task PostCommentAsync(int projectId, [FromBody] ProjectCommentResource comment) + { + return null; + } } } diff --git a/API/Extensions/DependencyInjectionExtensions.cs b/API/Extensions/DependencyInjectionExtensions.cs index 7b73fd1d..d495a09c 100644 --- a/API/Extensions/DependencyInjectionExtensions.cs +++ b/API/Extensions/DependencyInjectionExtensions.cs @@ -68,6 +68,9 @@ public static IServiceCollection AddServicesAndRepositories(this IServiceCollect services.AddScoped(); services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); services.AddScoped(); diff --git a/API/Resources/ProjectCommentResource.cs b/API/Resources/ProjectCommentResource.cs new file mode 100644 index 00000000..48ddba4e --- /dev/null +++ b/API/Resources/ProjectCommentResource.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace API.Resources +{ + public class ProjectCommentResource + { + public int Id { get; set; } + + public string Username { get; set; } + + public int UserId { get; set; } + + public DateTime DateCreated { get; set; } + + public DateTime DateUpdated { get; set; } + + public string Content { get; set; } + + } +} diff --git a/API/Resources/ProjectCommentResourceResult.cs b/API/Resources/ProjectCommentResourceResult.cs new file mode 100644 index 00000000..6740f09e --- /dev/null +++ b/API/Resources/ProjectCommentResourceResult.cs @@ -0,0 +1,24 @@ +using Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace API.Resources +{ + public class ProjectCommentResourceResult + { + + public int Id { get; set; } + + public User User { get; set; } + + public DateTime DateCreated { get; set; } + + public DateTime DateUpdated { get; set; } + + public string Content { get; set; } + + public List Likes { get; set; } + } +} diff --git a/Data/ApplicationDbContext.cs b/Data/ApplicationDbContext.cs index 171795be..0b317946 100644 --- a/Data/ApplicationDbContext.cs +++ b/Data/ApplicationDbContext.cs @@ -180,6 +180,22 @@ public ApplicationDbContext(DbContextOptions options) : ba /// public DbSet DataSourceWizardPage { get; set; } + /// + /// Gets or sets the comments made by users + /// + /// + /// A comment by a user + /// + public DbSet Comment { get; set; } + + /// + /// Gets or sets the comments liked by users. + /// + /// + /// The like by the user. + /// + public DbSet CommentLike { get; set; } + protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); diff --git a/Models/ProjectComment.cs b/Models/ProjectComment.cs new file mode 100644 index 00000000..b8812410 --- /dev/null +++ b/Models/ProjectComment.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; + +namespace Models +{ + + public class ProjectComment + { + + public int Id { get; set; } + + public int ProjectId { get; set; } + + public User User { get; set; } + + public DateTime DateCreated { get; set; } + + public DateTime DateUpdated { get; set; } + + public string Content { get; set; } + + public List Likes { get; set; } + + + } + +} diff --git a/Models/ProjectCommentLike.cs b/Models/ProjectCommentLike.cs new file mode 100644 index 00000000..9d7acc35 --- /dev/null +++ b/Models/ProjectCommentLike.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Models +{ + public class ProjectCommentLike + { + + public ProjectCommentLike(ProjectComment likedComment, User commentLiker) + { + LikedComment = likedComment; + CommentLiker = commentLiker; + Date = DateTime.Now; + } + + public ProjectCommentLike() { } + + public int Id { get; set; } + + public ProjectComment LikedComment { get; set; } + + public User CommentLiker { get; set; } + + public int UserId { get; set; } + + public DateTime Date { get; set; } + } +} diff --git a/Repositories/ProjectCommentRepository.cs b/Repositories/ProjectCommentRepository.cs new file mode 100644 index 00000000..f5b0fff3 --- /dev/null +++ b/Repositories/ProjectCommentRepository.cs @@ -0,0 +1,33 @@ +using Microsoft.EntityFrameworkCore; +using Models; +using Repositories.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; + +namespace Repositories +{ + + public interface IProjectCommentRepository : IRepository + { + Task> GetProjectComments(int projectId); + } + + public class ProjectCommentRepository : Repository, IProjectCommentRepository + { + + public ProjectCommentRepository(DbContext dbContext) : base(dbContext) + {} + + public Task> GetProjectComments(int projectId) + { + return DbSet.Where(p => p.ProjectId == projectId) + .ToListAsync(); + } + + + } +} diff --git a/Services/Services/ProjectCommentService.cs b/Services/Services/ProjectCommentService.cs new file mode 100644 index 00000000..cfee4696 --- /dev/null +++ b/Services/Services/ProjectCommentService.cs @@ -0,0 +1,29 @@ +using Models; +using Repositories; +using Services.Base; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Services.Services +{ + + public interface IProjectCommentService : IService + { + Task> GetProjectComments(int projectId); + } + + public class ProjectCommentService : Service, IProjectCommentService + { + + private new IProjectCommentRepository Repository => (IProjectCommentRepository) base.Repository; + + public ProjectCommentService(IProjectCommentRepository repository) : base(repository) + {} + + public Task> GetProjectComments(int projectId) + { + return Repository.GetProjectComments(projectId); + } + } + +} From 3b2859ca2b7408b665f52e001ebd9ea2cec608b1 Mon Sep 17 00:00:00 2001 From: "Nicole Bours(Desktop)" Date: Fri, 4 Jun 2021 13:30:14 +0200 Subject: [PATCH 07/19] migrations --- .../20210604111624_commments.Designer.cs | 816 ++++++++++++++++++ Data/Migrations/20210604111624_commments.cs | 85 ++ .../ApplicationDbContextModelSnapshot.cs | 74 ++ 3 files changed, 975 insertions(+) create mode 100644 Data/Migrations/20210604111624_commments.Designer.cs create mode 100644 Data/Migrations/20210604111624_commments.cs diff --git a/Data/Migrations/20210604111624_commments.Designer.cs b/Data/Migrations/20210604111624_commments.Designer.cs new file mode 100644 index 00000000..d0123279 --- /dev/null +++ b/Data/Migrations/20210604111624_commments.Designer.cs @@ -0,0 +1,816 @@ +// +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20210604111624_commments")] + partial class commments + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.CallToAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("OptionValue") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("CallToAction"); + }); + + modelBuilder.Entity("Models.CallToActionOption", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Type") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("CallToActionOption"); + }); + + modelBuilder.Entity("Models.Category", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Category"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.DataSource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Guid") + .HasColumnType("nvarchar(max)"); + + b.Property("IconId") + .HasColumnType("int"); + + b.Property("IsVisible") + .HasColumnType("bit"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("IconId"); + + b.ToTable("DataSource"); + }); + + modelBuilder.Entity("Models.DataSourceWizardPage", b => + { + b.Property("DataSourceId") + .HasColumnType("int"); + + b.Property("WizardPageId") + .HasColumnType("int"); + + b.Property("AuthFlow") + .HasColumnType("bit"); + + b.Property("OrderIndex") + .HasColumnType("int"); + + b.HasKey("DataSourceId", "WizardPageId", "AuthFlow"); + + b.HasIndex("WizardPageId"); + + b.ToTable("DataSourceWizardPage"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.File", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Path") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UploadDateTime") + .HasColumnType("datetime2"); + + b.Property("UploaderId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UploaderId"); + + b.ToTable("File"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ImageId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ImageId"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Institution", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Institution"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CallToActionId") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("InstitutePrivate") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectIconId") + .HasColumnType("int"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CallToActionId"); + + b.HasIndex("ProjectIconId"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.ProjectCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CategoryId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.HasIndex("ProjectId"); + + b.ToTable("ProjectCategory"); + }); + + modelBuilder.Entity("Models.ProjectComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("DateCreated") + .HasColumnType("datetime2"); + + b.Property("DateUpdated") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Comment"); + }); + + modelBuilder.Entity("Models.ProjectCommentLike", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("LikedCommentId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("LikedCommentId"); + + b.HasIndex("UserId"); + + b.ToTable("CommentLike"); + }); + + modelBuilder.Entity("Models.ProjectInstitution", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("InstitutionId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("InstitutionId"); + + b.HasIndex("ProjectId"); + + b.ToTable("ProjectInstitution"); + }); + + modelBuilder.Entity("Models.ProjectLike", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("LikedProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("LikedProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("ProjectLike"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AccountCreationDate") + .HasColumnType("datetime2"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ExpectedGraduationDate") + .HasColumnType("datetime2"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InstitutionId") + .HasColumnType("int"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("InstitutionId"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("UserProject"); + }); + + modelBuilder.Entity("Models.UserTask", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserTask"); + }); + + modelBuilder.Entity("Models.UserUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FollowedUserId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FollowedUserId"); + + b.HasIndex("UserId"); + + b.ToTable("UserUser"); + }); + + modelBuilder.Entity("Models.WizardPage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("WizardPage"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.DataSource", b => + { + b.HasOne("Models.File", "Icon") + .WithMany() + .HasForeignKey("IconId"); + }); + + modelBuilder.Entity("Models.DataSourceWizardPage", b => + { + b.HasOne("Models.DataSource", "DataSource") + .WithMany("DataSourceWizardPages") + .HasForeignKey("DataSourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.WizardPage", "WizardPage") + .WithMany("DataSourceWizardPages") + .HasForeignKey("WizardPageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.File", b => + { + b.HasOne("Models.Project", null) + .WithMany("Images") + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "Uploader") + .WithMany() + .HasForeignKey("UploaderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.File", "Image") + .WithMany() + .HasForeignKey("ImageId"); + + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.CallToAction", "CallToAction") + .WithMany() + .HasForeignKey("CallToActionId"); + + b.HasOne("Models.File", "ProjectIcon") + .WithMany() + .HasForeignKey("ProjectIconId"); + + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.ProjectCategory", b => + { + b.HasOne("Models.Category", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.Project", "Project") + .WithMany("Categories") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.ProjectComment", b => + { + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Models.ProjectCommentLike", b => + { + b.HasOne("Models.ProjectComment", "LikedComment") + .WithMany("Likes") + .HasForeignKey("LikedCommentId"); + + b.HasOne("Models.User", "CommentLiker") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.ProjectInstitution", b => + { + b.HasOne("Models.Institution", "Institution") + .WithMany() + .HasForeignKey("InstitutionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.Project", "Project") + .WithMany("LinkedInstitutions") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.ProjectLike", b => + { + b.HasOne("Models.Project", "LikedProject") + .WithMany("Likes") + .HasForeignKey("LikedProjectId"); + + b.HasOne("Models.User", "ProjectLiker") + .WithMany("LikedProjectsByUsers") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Institution", "Institution") + .WithMany() + .HasForeignKey("InstitutionId"); + + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "User") + .WithMany("UserProject") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.UserTask", b => + { + b.HasOne("Models.User", "User") + .WithMany("UserTasks") + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Models.UserUser", b => + { + b.HasOne("Models.User", "FollowedUser") + .WithMany("FollowedUsers") + .HasForeignKey("FollowedUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20210604111624_commments.cs b/Data/Migrations/20210604111624_commments.cs new file mode 100644 index 00000000..5f7236d0 --- /dev/null +++ b/Data/Migrations/20210604111624_commments.cs @@ -0,0 +1,85 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class commments : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Comment", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ProjectId = table.Column(nullable: false), + UserId = table.Column(nullable: true), + DateCreated = table.Column(nullable: false), + DateUpdated = table.Column(nullable: false), + Content = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Comment", x => x.Id); + table.ForeignKey( + name: "FK_Comment_User_UserId", + column: x => x.UserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CommentLike", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + LikedCommentId = table.Column(nullable: true), + UserId = table.Column(nullable: false), + Date = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CommentLike", x => x.Id); + table.ForeignKey( + name: "FK_CommentLike_Comment_LikedCommentId", + column: x => x.LikedCommentId, + principalTable: "Comment", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CommentLike_User_UserId", + column: x => x.UserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Comment_UserId", + table: "Comment", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_CommentLike_LikedCommentId", + table: "CommentLike", + column: "LikedCommentId"); + + migrationBuilder.CreateIndex( + name: "IX_CommentLike_UserId", + table: "CommentLike", + column: "UserId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CommentLike"); + + migrationBuilder.DropTable( + name: "Comment"); + } + } +} diff --git a/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/Data/Migrations/ApplicationDbContextModelSnapshot.cs index 749ddce9..a78b81f9 100644 --- a/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -331,6 +331,60 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("ProjectCategory"); }); + modelBuilder.Entity("Models.ProjectComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("DateCreated") + .HasColumnType("datetime2"); + + b.Property("DateUpdated") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Comment"); + }); + + modelBuilder.Entity("Models.ProjectCommentLike", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("LikedCommentId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("LikedCommentId"); + + b.HasIndex("UserId"); + + b.ToTable("CommentLike"); + }); + modelBuilder.Entity("Models.ProjectInstitution", b => { b.Property("Id") @@ -654,6 +708,26 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired(); }); + modelBuilder.Entity("Models.ProjectComment", b => + { + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Models.ProjectCommentLike", b => + { + b.HasOne("Models.ProjectComment", "LikedComment") + .WithMany("Likes") + .HasForeignKey("LikedCommentId"); + + b.HasOne("Models.User", "CommentLiker") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("Models.ProjectInstitution", b => { b.HasOne("Models.Institution", "Institution") From 34ec28f83d3da4ee56aa4f8781c75ee72d25fbe6 Mon Sep 17 00:00:00 2001 From: "Nicole Bours(Desktop)" Date: Fri, 4 Jun 2021 14:37:49 +0200 Subject: [PATCH 08/19] Update ProjectController.cs --- API/Controllers/ProjectController.cs | 45 ++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index 6f4539fd..6d971410 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -1456,9 +1456,50 @@ public async Task GetCommentsAsync(int projectId) [ProducesResponseType(typeof(ProjectCommentResourceResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status401Unauthorized)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)] - public async Task PostCommentAsync(int projectId, [FromBody] ProjectCommentResource comment) + public async Task AddCommentToProject(int projectId, [FromBody] ProjectCommentResource projectCommentResource) { - return null; + Project project = await projectService.FindAsync(projectId).ConfigureAwait(false); + if(project == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed to add comment to the project.", + Detail = "The project could not be found in the database.", + Instance = "1C8D069D-E6CE-43E2-9CF9-D82C0A71A293" + }; + return NotFound(problem); + } + if(projectCommentResource.Content == null || projectCommentResource.UserId == null || projectCommentResource.Content == "") + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed to add comment to the project.", + Detail = "Not all necessary Fields are filled in.", + Instance = "1C8D069D-E6CE-43E2-9CF9-D82C0A71A294" + }; + return BadRequest(problem); + } + + + ProjectComment projectComment = mapper.Map(projectCommentResource); + projectComment.User = await HttpContext.GetContextUser(userService).ConfigureAwait(false); + projectComment.ProjectId = projectId; + try + { + projectCommentService.Add(projectComment); + projectCommentService.Save(); + return Created(nameof(AddCommentToProject), mapper.Map(projectComment)); + }catch(DbUpdateException e) + { + Log.Logger.Error(e, "Database exception"); + ProblemDetails problem = new ProblemDetails + { + Title = "Failed to add comment to the project.", + Detail = "There was a problem while saving thecomment.", + Instance = "1C8D069D-E6CE-43E2-9CF9-D82C0A71A292" + }; + return BadRequest(problem); + } } } From 4994f4079f7c306ef9169fa69e64d56c5afd48a8 Mon Sep 17 00:00:00 2001 From: "Nicole Bours(Desktop)" Date: Thu, 10 Jun 2021 15:50:44 +0200 Subject: [PATCH 09/19] :adhesive_bandage: add datetime to comment --- API/Controllers/ProjectController.cs | 2 ++ Models/ProjectComment.cs | 3 +++ 2 files changed, 5 insertions(+) diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index 6d971410..68299fbe 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -1484,6 +1484,8 @@ public async Task AddCommentToProject(int projectId, [FromBody] P ProjectComment projectComment = mapper.Map(projectCommentResource); projectComment.User = await HttpContext.GetContextUser(userService).ConfigureAwait(false); projectComment.ProjectId = projectId; + projectComment.DateCreated = DateTime.Now; + projectComment.DateUpdated = DateTime.Now; try { projectCommentService.Add(projectComment); diff --git a/Models/ProjectComment.cs b/Models/ProjectComment.cs index b8812410..fd42e7d9 100644 --- a/Models/ProjectComment.cs +++ b/Models/ProjectComment.cs @@ -20,7 +20,10 @@ public class ProjectComment public string Content { get; set; } public List Likes { get; set; } + public ProjectComment() + { + } } From 6035d3b078fde04b03ee3b67e3c92a62a39da397 Mon Sep 17 00:00:00 2001 From: "Nicole Bours(Desktop)" Date: Thu, 10 Jun 2021 16:08:43 +0200 Subject: [PATCH 10/19] :adhesive_bandage: include user on get comment --- Repositories/ProjectCommentRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Repositories/ProjectCommentRepository.cs b/Repositories/ProjectCommentRepository.cs index f5b0fff3..4ba6bba3 100644 --- a/Repositories/ProjectCommentRepository.cs +++ b/Repositories/ProjectCommentRepository.cs @@ -24,7 +24,7 @@ public ProjectCommentRepository(DbContext dbContext) : base(dbContext) public Task> GetProjectComments(int projectId) { - return DbSet.Where(p => p.ProjectId == projectId) + return DbSet.Where(p => p.ProjectId == projectId).Include(u => u.User) .ToListAsync(); } From 3ad73be8d979ee7a559034f7063c90c3cce2d285 Mon Sep 17 00:00:00 2001 From: "Nicole Bours(Desktop)" Date: Fri, 11 Jun 2021 09:44:45 +0200 Subject: [PATCH 11/19] :recycle: corrected update/created comment :recycle: corrected the update/created in comment model --- API/Controllers/ProjectController.cs | 3 +- ...4046_updateProjectCommentModel.Designer.cs | 816 ++++++++++++++++++ ...0210611074046_updateProjectCommentModel.cs | 56 ++ .../ApplicationDbContextModelSnapshot.cs | 8 +- Models/ProjectComment.cs | 4 +- 5 files changed, 879 insertions(+), 8 deletions(-) create mode 100644 Data/Migrations/20210611074046_updateProjectCommentModel.Designer.cs create mode 100644 Data/Migrations/20210611074046_updateProjectCommentModel.cs diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index 68299fbe..47f99bdd 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -1484,8 +1484,7 @@ public async Task AddCommentToProject(int projectId, [FromBody] P ProjectComment projectComment = mapper.Map(projectCommentResource); projectComment.User = await HttpContext.GetContextUser(userService).ConfigureAwait(false); projectComment.ProjectId = projectId; - projectComment.DateCreated = DateTime.Now; - projectComment.DateUpdated = DateTime.Now; + try { projectCommentService.Add(projectComment); diff --git a/Data/Migrations/20210611074046_updateProjectCommentModel.Designer.cs b/Data/Migrations/20210611074046_updateProjectCommentModel.Designer.cs new file mode 100644 index 00000000..486b0289 --- /dev/null +++ b/Data/Migrations/20210611074046_updateProjectCommentModel.Designer.cs @@ -0,0 +1,816 @@ +// +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20210611074046_updateProjectCommentModel")] + partial class updateProjectCommentModel + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.CallToAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("OptionValue") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("CallToAction"); + }); + + modelBuilder.Entity("Models.CallToActionOption", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Type") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("CallToActionOption"); + }); + + modelBuilder.Entity("Models.Category", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Category"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.DataSource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Guid") + .HasColumnType("nvarchar(max)"); + + b.Property("IconId") + .HasColumnType("int"); + + b.Property("IsVisible") + .HasColumnType("bit"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("IconId"); + + b.ToTable("DataSource"); + }); + + modelBuilder.Entity("Models.DataSourceWizardPage", b => + { + b.Property("DataSourceId") + .HasColumnType("int"); + + b.Property("WizardPageId") + .HasColumnType("int"); + + b.Property("AuthFlow") + .HasColumnType("bit"); + + b.Property("OrderIndex") + .HasColumnType("int"); + + b.HasKey("DataSourceId", "WizardPageId", "AuthFlow"); + + b.HasIndex("WizardPageId"); + + b.ToTable("DataSourceWizardPage"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.File", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Path") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UploadDateTime") + .HasColumnType("datetime2"); + + b.Property("UploaderId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UploaderId"); + + b.ToTable("File"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ImageId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ImageId"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Institution", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Institution"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CallToActionId") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("InstitutePrivate") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectIconId") + .HasColumnType("int"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CallToActionId"); + + b.HasIndex("ProjectIconId"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.ProjectCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CategoryId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.HasIndex("ProjectId"); + + b.ToTable("ProjectCategory"); + }); + + modelBuilder.Entity("Models.ProjectComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Comment"); + }); + + modelBuilder.Entity("Models.ProjectCommentLike", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("LikedCommentId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("LikedCommentId"); + + b.HasIndex("UserId"); + + b.ToTable("CommentLike"); + }); + + modelBuilder.Entity("Models.ProjectInstitution", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("InstitutionId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("InstitutionId"); + + b.HasIndex("ProjectId"); + + b.ToTable("ProjectInstitution"); + }); + + modelBuilder.Entity("Models.ProjectLike", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("LikedProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("LikedProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("ProjectLike"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AccountCreationDate") + .HasColumnType("datetime2"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ExpectedGraduationDate") + .HasColumnType("datetime2"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InstitutionId") + .HasColumnType("int"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("InstitutionId"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("UserProject"); + }); + + modelBuilder.Entity("Models.UserTask", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserTask"); + }); + + modelBuilder.Entity("Models.UserUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FollowedUserId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FollowedUserId"); + + b.HasIndex("UserId"); + + b.ToTable("UserUser"); + }); + + modelBuilder.Entity("Models.WizardPage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("WizardPage"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.DataSource", b => + { + b.HasOne("Models.File", "Icon") + .WithMany() + .HasForeignKey("IconId"); + }); + + modelBuilder.Entity("Models.DataSourceWizardPage", b => + { + b.HasOne("Models.DataSource", "DataSource") + .WithMany("DataSourceWizardPages") + .HasForeignKey("DataSourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.WizardPage", "WizardPage") + .WithMany("DataSourceWizardPages") + .HasForeignKey("WizardPageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.File", b => + { + b.HasOne("Models.Project", null) + .WithMany("Images") + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "Uploader") + .WithMany() + .HasForeignKey("UploaderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.File", "Image") + .WithMany() + .HasForeignKey("ImageId"); + + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.CallToAction", "CallToAction") + .WithMany() + .HasForeignKey("CallToActionId"); + + b.HasOne("Models.File", "ProjectIcon") + .WithMany() + .HasForeignKey("ProjectIconId"); + + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.ProjectCategory", b => + { + b.HasOne("Models.Category", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.Project", "Project") + .WithMany("Categories") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.ProjectComment", b => + { + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Models.ProjectCommentLike", b => + { + b.HasOne("Models.ProjectComment", "LikedComment") + .WithMany("Likes") + .HasForeignKey("LikedCommentId"); + + b.HasOne("Models.User", "CommentLiker") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.ProjectInstitution", b => + { + b.HasOne("Models.Institution", "Institution") + .WithMany() + .HasForeignKey("InstitutionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.Project", "Project") + .WithMany("LinkedInstitutions") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.ProjectLike", b => + { + b.HasOne("Models.Project", "LikedProject") + .WithMany("Likes") + .HasForeignKey("LikedProjectId"); + + b.HasOne("Models.User", "ProjectLiker") + .WithMany("LikedProjectsByUsers") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Institution", "Institution") + .WithMany() + .HasForeignKey("InstitutionId"); + + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "User") + .WithMany("UserProject") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.UserTask", b => + { + b.HasOne("Models.User", "User") + .WithMany("UserTasks") + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Models.UserUser", b => + { + b.HasOne("Models.User", "FollowedUser") + .WithMany("FollowedUsers") + .HasForeignKey("FollowedUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20210611074046_updateProjectCommentModel.cs b/Data/Migrations/20210611074046_updateProjectCommentModel.cs new file mode 100644 index 00000000..0814c929 --- /dev/null +++ b/Data/Migrations/20210611074046_updateProjectCommentModel.cs @@ -0,0 +1,56 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class updateProjectCommentModel : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "DateCreated", + table: "Comment"); + + migrationBuilder.DropColumn( + name: "DateUpdated", + table: "Comment"); + + migrationBuilder.AddColumn( + name: "Created", + table: "Comment", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + migrationBuilder.AddColumn( + name: "Updated", + table: "Comment", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Created", + table: "Comment"); + + migrationBuilder.DropColumn( + name: "Updated", + table: "Comment"); + + migrationBuilder.AddColumn( + name: "DateCreated", + table: "Comment", + type: "datetime2", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + migrationBuilder.AddColumn( + name: "DateUpdated", + table: "Comment", + type: "datetime2", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + } + } +} diff --git a/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/Data/Migrations/ApplicationDbContextModelSnapshot.cs index a78b81f9..5e8f09e8 100644 --- a/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -341,15 +341,15 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Content") .HasColumnType("nvarchar(max)"); - b.Property("DateCreated") - .HasColumnType("datetime2"); - - b.Property("DateUpdated") + b.Property("Created") .HasColumnType("datetime2"); b.Property("ProjectId") .HasColumnType("int"); + b.Property("Updated") + .HasColumnType("datetime2"); + b.Property("UserId") .HasColumnType("int"); diff --git a/Models/ProjectComment.cs b/Models/ProjectComment.cs index fd42e7d9..8c2f5c64 100644 --- a/Models/ProjectComment.cs +++ b/Models/ProjectComment.cs @@ -13,9 +13,9 @@ public class ProjectComment public User User { get; set; } - public DateTime DateCreated { get; set; } + public DateTime Created { get; set; } - public DateTime DateUpdated { get; set; } + public DateTime Updated { get; set; } public string Content { get; set; } From 5e50bcf02375f8f89c35b3c9843e5b62118ed016 Mon Sep 17 00:00:00 2001 From: "Nicole Bours(Desktop)" Date: Fri, 11 Jun 2021 11:56:46 +0200 Subject: [PATCH 12/19] update commentresourcemodel --- API/Resources/ProjectCommentResource.cs | 4 +- API/Resources/ProjectCommentResourceResult.cs | 4 +- ...ateProjectCommentResourceModel.Designer.cs | 816 ++++++++++++++++++ ...95549_updateProjectCommentResourceModel.cs | 17 + Models/ProjectComment.cs | 2 +- 5 files changed, 838 insertions(+), 5 deletions(-) create mode 100644 Data/Migrations/20210611095549_updateProjectCommentResourceModel.Designer.cs create mode 100644 Data/Migrations/20210611095549_updateProjectCommentResourceModel.cs diff --git a/API/Resources/ProjectCommentResource.cs b/API/Resources/ProjectCommentResource.cs index 48ddba4e..3afe041d 100644 --- a/API/Resources/ProjectCommentResource.cs +++ b/API/Resources/ProjectCommentResource.cs @@ -13,9 +13,9 @@ public class ProjectCommentResource public int UserId { get; set; } - public DateTime DateCreated { get; set; } + public DateTime Created { get; set; } - public DateTime DateUpdated { get; set; } + public DateTime Updated { get; set; } public string Content { get; set; } diff --git a/API/Resources/ProjectCommentResourceResult.cs b/API/Resources/ProjectCommentResourceResult.cs index 6740f09e..76a7f562 100644 --- a/API/Resources/ProjectCommentResourceResult.cs +++ b/API/Resources/ProjectCommentResourceResult.cs @@ -13,9 +13,9 @@ public class ProjectCommentResourceResult public User User { get; set; } - public DateTime DateCreated { get; set; } + public DateTime Created { get; set; } - public DateTime DateUpdated { get; set; } + public DateTime Updated { get; set; } public string Content { get; set; } diff --git a/Data/Migrations/20210611095549_updateProjectCommentResourceModel.Designer.cs b/Data/Migrations/20210611095549_updateProjectCommentResourceModel.Designer.cs new file mode 100644 index 00000000..144a39e2 --- /dev/null +++ b/Data/Migrations/20210611095549_updateProjectCommentResourceModel.Designer.cs @@ -0,0 +1,816 @@ +// +using System; +using Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace _4_Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20210611095549_updateProjectCommentResourceModel")] + partial class updateProjectCommentResourceModel + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Models.CallToAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("OptionValue") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("CallToAction"); + }); + + modelBuilder.Entity("Models.CallToActionOption", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Type") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("CallToActionOption"); + }); + + modelBuilder.Entity("Models.Category", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Category"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Collaborators"); + }); + + modelBuilder.Entity("Models.DataSource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Guid") + .HasColumnType("nvarchar(max)"); + + b.Property("IconId") + .HasColumnType("int"); + + b.Property("IsVisible") + .HasColumnType("bit"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("IconId"); + + b.ToTable("DataSource"); + }); + + modelBuilder.Entity("Models.DataSourceWizardPage", b => + { + b.Property("DataSourceId") + .HasColumnType("int"); + + b.Property("WizardPageId") + .HasColumnType("int"); + + b.Property("AuthFlow") + .HasColumnType("bit"); + + b.Property("OrderIndex") + .HasColumnType("int"); + + b.HasKey("DataSourceId", "WizardPageId", "AuthFlow"); + + b.HasIndex("WizardPageId"); + + b.ToTable("DataSourceWizardPage"); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Guid") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("EmbeddedProject"); + }); + + modelBuilder.Entity("Models.File", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Path") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UploadDateTime") + .HasColumnType("datetime2"); + + b.Property("UploaderId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UploaderId"); + + b.ToTable("File"); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ImageId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ImageId"); + + b.HasIndex("ProjectId"); + + b.ToTable("Highlight"); + }); + + modelBuilder.Entity("Models.Institution", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("IdentityId") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Institution"); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CallToActionId") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("InstitutePrivate") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectIconId") + .HasColumnType("int"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("Uri") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CallToActionId"); + + b.HasIndex("ProjectIconId"); + + b.HasIndex("UserId"); + + b.ToTable("Project"); + }); + + modelBuilder.Entity("Models.ProjectCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CategoryId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.HasIndex("ProjectId"); + + b.ToTable("ProjectCategory"); + }); + + modelBuilder.Entity("Models.ProjectComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("Updated") + .HasColumnType("datetime2"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Comment"); + }); + + modelBuilder.Entity("Models.ProjectCommentLike", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("LikedCommentId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("LikedCommentId"); + + b.HasIndex("UserId"); + + b.ToTable("CommentLike"); + }); + + modelBuilder.Entity("Models.ProjectInstitution", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("InstitutionId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("InstitutionId"); + + b.HasIndex("ProjectId"); + + b.ToTable("ProjectInstitution"); + }); + + modelBuilder.Entity("Models.ProjectLike", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("LikedProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("LikedProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("ProjectLike"); + }); + + modelBuilder.Entity("Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Role"); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("Scope") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleScope"); + }); + + modelBuilder.Entity("Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AccountCreationDate") + .HasColumnType("datetime2"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ExpectedGraduationDate") + .HasColumnType("datetime2"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InstitutionId") + .HasColumnType("int"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("InstitutionId"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UserId"); + + b.ToTable("UserProject"); + }); + + modelBuilder.Entity("Models.UserTask", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserTask"); + }); + + modelBuilder.Entity("Models.UserUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("FollowedUserId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FollowedUserId"); + + b.HasIndex("UserId"); + + b.ToTable("UserUser"); + }); + + modelBuilder.Entity("Models.WizardPage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("WizardPage"); + }); + + modelBuilder.Entity("Models.Collaborator", b => + { + b.HasOne("Models.Project", null) + .WithMany("Collaborators") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.DataSource", b => + { + b.HasOne("Models.File", "Icon") + .WithMany() + .HasForeignKey("IconId"); + }); + + modelBuilder.Entity("Models.DataSourceWizardPage", b => + { + b.HasOne("Models.DataSource", "DataSource") + .WithMany("DataSourceWizardPages") + .HasForeignKey("DataSourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.WizardPage", "WizardPage") + .WithMany("DataSourceWizardPages") + .HasForeignKey("WizardPageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.EmbeddedProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.File", b => + { + b.HasOne("Models.Project", null) + .WithMany("Images") + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "Uploader") + .WithMany() + .HasForeignKey("UploaderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Highlight", b => + { + b.HasOne("Models.File", "Image") + .WithMany() + .HasForeignKey("ImageId"); + + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.Project", b => + { + b.HasOne("Models.CallToAction", "CallToAction") + .WithMany() + .HasForeignKey("CallToActionId"); + + b.HasOne("Models.File", "ProjectIcon") + .WithMany() + .HasForeignKey("ProjectIconId"); + + b.HasOne("Models.User", "User") + .WithMany("Projects") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.ProjectCategory", b => + { + b.HasOne("Models.Category", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.Project", "Project") + .WithMany("Categories") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.ProjectComment", b => + { + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Models.ProjectCommentLike", b => + { + b.HasOne("Models.ProjectComment", "LikedComment") + .WithMany("Likes") + .HasForeignKey("LikedCommentId"); + + b.HasOne("Models.User", "CommentLiker") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.ProjectInstitution", b => + { + b.HasOne("Models.Institution", "Institution") + .WithMany() + .HasForeignKey("InstitutionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.Project", "Project") + .WithMany("LinkedInstitutions") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.ProjectLike", b => + { + b.HasOne("Models.Project", "LikedProject") + .WithMany("Likes") + .HasForeignKey("LikedProjectId"); + + b.HasOne("Models.User", "ProjectLiker") + .WithMany("LikedProjectsByUsers") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.RoleScope", b => + { + b.HasOne("Models.Role", null) + .WithMany("Scopes") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.User", b => + { + b.HasOne("Models.Institution", "Institution") + .WithMany() + .HasForeignKey("InstitutionId"); + + b.HasOne("Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + }); + + modelBuilder.Entity("Models.UserProject", b => + { + b.HasOne("Models.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId"); + + b.HasOne("Models.User", "User") + .WithMany("UserProject") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Models.UserTask", b => + { + b.HasOne("Models.User", "User") + .WithMany("UserTasks") + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Models.UserUser", b => + { + b.HasOne("Models.User", "FollowedUser") + .WithMany("FollowedUsers") + .HasForeignKey("FollowedUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Models.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Data/Migrations/20210611095549_updateProjectCommentResourceModel.cs b/Data/Migrations/20210611095549_updateProjectCommentResourceModel.cs new file mode 100644 index 00000000..77288459 --- /dev/null +++ b/Data/Migrations/20210611095549_updateProjectCommentResourceModel.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace _4_Data.Migrations +{ + public partial class updateProjectCommentResourceModel : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/Models/ProjectComment.cs b/Models/ProjectComment.cs index 8c2f5c64..4a11b562 100644 --- a/Models/ProjectComment.cs +++ b/Models/ProjectComment.cs @@ -10,7 +10,7 @@ public class ProjectComment public int Id { get; set; } public int ProjectId { get; set; } - + public User User { get; set; } public DateTime Created { get; set; } From 84fe74848951e095077905b1558d05d3ccc329e9 Mon Sep 17 00:00:00 2001 From: "Nicole Bours(Desktop)" Date: Wed, 16 Jun 2021 10:15:01 +0200 Subject: [PATCH 13/19] Add UpdateProjectComment --- API/Controllers/ProjectController.cs | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index 47f99bdd..41b72ca5 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -1502,6 +1502,49 @@ public async Task AddCommentToProject(int projectId, [FromBody] P return BadRequest(problem); } } + + /// + /// this method is responsible for updating the comment with the specified identifier. + /// + /// + /// + /// + [HttpPut("comment/{projectCommentId}")] + [Authorize] + public async Task UpdateComment(int projectCommentId, [FromBody] ProjectCommentResource projectCommentResource) + { + ProjectComment projectComment = await projectCommentService.FindAsync(projectCommentId); + if(projectComment == null) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed to update Comment.", + Detail = "The specified Comment could not be found in the database.", + Instance = "b27d3600-33b0-42a0-99aa-4b2f28ea07bb" + }; + return NotFound(problem); + + } + User user = await HttpContext.GetContextUser(userService).ConfigureAwait(false); + bool isAllowed = userService.UserHasScope(user.IdentityId, nameof(Defaults.Scopes.AdminProjectWrite)); + + if(!(projectComment.User.Id == user.Id || isAllowed)) + { + ProblemDetails problem = new ProblemDetails + { + Title = "Failed to edit the comment.", + Detail = "The user is not allowed to edit the comment.", + Instance = "906cd8ad-b75c-4efb-9838-849f99e8026b" + }; + return Unauthorized(problem); + } + mapper.Map(projectCommentResource, projectComment); + projectCommentService.Update(projectComment); + projectService.Save(); + return Ok(mapper.Map(projectComment)); + + } } + } From b9cd9b63ea7fba49c55797856340f11339381bb3 Mon Sep 17 00:00:00 2001 From: "Nicole Bours(Desktop)" Date: Wed, 16 Jun 2021 13:15:17 +0200 Subject: [PATCH 14/19] projectlike repository + service --- API/Controllers/ProjectController.cs | 69 ++++++++++++++++++- .../UserProjectCommentLikeRepository.cs | 35 ++++++++++ .../Services/UserProjectCommentLikeService.cs | 44 ++++++++++++ 3 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 Repositories/UserProjectCommentLikeRepository.cs create mode 100644 Services/Services/UserProjectCommentLikeService.cs diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index 41b72ca5..dbbccca8 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -62,6 +62,7 @@ public class ProjectController : ControllerBase private readonly IUserService userService; private readonly IProjectInstitutionService projectInstitutionService; private readonly IInstitutionService institutionService; + private readonly IUserProjectCommentLikeService userProjectCommentLikeService; /// /// Initializes a new instance of the class /// @@ -86,6 +87,7 @@ public class ProjectController : ControllerBase /// The category service is used to work with categories /// The project category service is used to connect projects and categories /// + /// /// The projectinstitution service is responsible for link projects and institutions. /// The institution service which is used to communicate with the logic layer public ProjectController(IProjectService projectService, @@ -101,7 +103,8 @@ public ProjectController(IProjectService projectService, ICallToActionOptionService callToActionOptionService, ICategoryService categoryService, IProjectCategoryService projectCategoryService, - IProjectCommentService projectCommentService) + IProjectCommentService projectCommentService, + IUserProjectCommentLikeService userProjectCommentLikeService) { this.projectService = projectService; this.userService = userService; @@ -117,6 +120,7 @@ public ProjectController(IProjectService projectService, this.projectInstitutionService = projectInstitutionService; this.institutionService = institutionService; this.projectCommentService = projectCommentService; + this.userProjectCommentLikeService = userProjectCommentLikeService; } @@ -1449,6 +1453,7 @@ public async Task GetCommentsAsync(int projectId) /// Post a new comment to the provided project-id /// /// The project-id to add the new comment to + /// /// The added comment and its metadata /// [HttpPost("comment/{projectId}")] @@ -1544,7 +1549,67 @@ public async Task UpdateComment(int projectCommentId, [FromBody] return Ok(mapper.Map(projectComment)); } + [HttpPost("comment/like{projectCommentId}")] + [Authorize] + public async Task LikeProjectComment(int projectCommentId) + { + User currentUser = await HttpContext.GetContextUser(userService) + .ConfigureAwait(false); + + if(currentUser == null) + { + ProblemDetails problemDetails = new ProblemDetails + { + Title = "Failed to getting the user account.", + Detail = + "The database does not contain a user with the provided user id.", + Instance = "F8DB2F94-48DA-4FEB-9BDA-FF24A59333C1" + }; + return NotFound(problemDetails); + } + if(!userProjectCommentLikeService.CheckIfUserAlreadyLiked(currentUser.Id, projectCommentId)) + { + ProblemDetails problemDetails = new ProblemDetails + { + Title = "User already liked this comment", + Detail = "You already liked this comment.", + Instance = "5B0104E2-C864-4ADB-9321-32CD352DC124" + }; + return Conflict(problemDetails); + } + ProjectComment projectCommentToLike = await projectCommentService.FindAsync(projectCommentId); + if(projectCommentToLike == null) + { + ProblemDetails problemDetails = new ProblemDetails + { + Title = "Failed to getting the comment.", + Detail = + "The database does not contain a comment with the provided comment id.", + Instance = "711B2DDE-D028-479E-8CB7-33F587478F8F" + }; + return NotFound(problemDetails); + } + try + { + ProjectCommentLike projectCommentLike = new ProjectCommentLike(projectCommentToLike, currentUser); + await userProjectCommentLikeService.AddAsync(projectCommentLike).ConfigureAwait(false); + userProjectCommentLikeService.Save(); + //Todo: Fix return met mapper etc. + return Ok(); + }catch(DbUpdateException e) + { + Log.Logger.Error(e, "database exception"); + + ProblemDetails problemDetails = new ProblemDetails + { + Title = "Could not create the liked comment details.", + Detail = "The database failed to save the liked comment.", + Instance = "F941879E-6C25-4A35-A962-8E86382E1849" + }; + return BadRequest(problemDetails); + } + + } } - } diff --git a/Repositories/UserProjectCommentLikeRepository.cs b/Repositories/UserProjectCommentLikeRepository.cs new file mode 100644 index 00000000..635939ea --- /dev/null +++ b/Repositories/UserProjectCommentLikeRepository.cs @@ -0,0 +1,35 @@ +using MessageBrokerPublisher; +using Microsoft.EntityFrameworkCore; +using Models; +using Repositories.Base; +using System.Linq; + +namespace Repositories +{ + public interface IUserProjectCommentLikeRepository: IRepository +{ + bool CheckIfUserAlreadyLiked(int userId, int projectCommentId); +} + public class UserProjectCommentLikeRepository : Repository, IUserProjectCommentLikeRepository + { + private ITaskPublisher taskPublisher; + public UserProjectCommentLikeRepository(DbContext dbContext, ITaskPublisher taskPublisher) : base(dbContext) + { + this.taskPublisher = taskPublisher; + } + public override void Add(ProjectCommentLike projectCommentLike) + { + DbContext.Add(projectCommentLike); + } + + bool IUserProjectCommentLikeRepository.CheckIfUserAlreadyLiked(int userId, int projectCommentId) + { + ProjectCommentLike projectCommentLike = GetDbSet().SingleOrDefault(comment => comment.CommentLiker.Id == userId && comment.LikedComment.Id == projectCommentId); + if(projectCommentLike != null) + { + return true; + } + return false; + } + } +} diff --git a/Services/Services/UserProjectCommentLikeService.cs b/Services/Services/UserProjectCommentLikeService.cs new file mode 100644 index 00000000..68f0f473 --- /dev/null +++ b/Services/Services/UserProjectCommentLikeService.cs @@ -0,0 +1,44 @@ +using Models; +using Repositories; +using Services.Base; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Services.Services +{ + /// + /// This is the project comment like service interface + /// + public interface IUserProjectCommentLikeService : IService + { + + /// + /// This is the interface method which checks if the user already like a comment + /// + /// + /// + /// Boolean + bool CheckIfUserAlreadyLiked(int userId, int projectCommentId); + + } + public class UserProjectCommentLikeService : Service, IUserProjectCommentLikeService + { + private readonly IProjectCommentRepository projectCommentRepository; + public UserProjectCommentLikeService(IUserProjectCommentLikeRepository repository, IProjectCommentRepository projectCommentRepository) : base(repository) + { + this.projectCommentRepository = projectCommentRepository; + + } + private new IUserProjectCommentLikeRepository Repository => (IUserProjectCommentLikeRepository) base.Repository; + + bool IUserProjectCommentLikeService.CheckIfUserAlreadyLiked(int userId, int projectCommentId) + { + if(Repository.CheckIfUserAlreadyLiked(userId, projectCommentId)) + { + return true; + } + return false; + } + } +} From a68821b05ae5228aaac922911195e08346f852ab Mon Sep 17 00:00:00 2001 From: "Nicole Bours(Desktop)" Date: Wed, 16 Jun 2021 14:05:34 +0200 Subject: [PATCH 15/19] Create UserProjectCommentLikeResourceResult.cs --- .../UserProjectCommentLikeResourceResult.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 API/Resources/UserProjectCommentLikeResourceResult.cs diff --git a/API/Resources/UserProjectCommentLikeResourceResult.cs b/API/Resources/UserProjectCommentLikeResourceResult.cs new file mode 100644 index 00000000..ad60c82d --- /dev/null +++ b/API/Resources/UserProjectCommentLikeResourceResult.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace API.Resources +{/// +/// +/// + public class UserProjectCommentLikeResourceResult + { + public int Id { get; set; } + public string comment { get; set; } + + } +} From caf276828f0b2420277093b47823a664421747fe Mon Sep 17 00:00:00 2001 From: "Nicole Bours(Desktop)" Date: Wed, 16 Jun 2021 14:09:07 +0200 Subject: [PATCH 16/19] Update ProjectController.cs --- API/Controllers/ProjectController.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index dbbccca8..f79fb3ca 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -1583,8 +1583,7 @@ public async Task LikeProjectComment(int projectCommentId) ProblemDetails problemDetails = new ProblemDetails { Title = "Failed to getting the comment.", - Detail = - "The database does not contain a comment with the provided comment id.", + Detail = "The database does not contain a comment with the provided comment id.", Instance = "711B2DDE-D028-479E-8CB7-33F587478F8F" }; return NotFound(problemDetails); @@ -1594,8 +1593,8 @@ public async Task LikeProjectComment(int projectCommentId) ProjectCommentLike projectCommentLike = new ProjectCommentLike(projectCommentToLike, currentUser); await userProjectCommentLikeService.AddAsync(projectCommentLike).ConfigureAwait(false); userProjectCommentLikeService.Save(); - //Todo: Fix return met mapper etc. - return Ok(); + + return Ok(mapper.Map< ProjectCommentLike, UserProjectCommentLikeResourceResult>(projectCommentLike)); }catch(DbUpdateException e) { Log.Logger.Error(e, "database exception"); From 67909c61ec5bb9053ad5560c6cdb402abadf5462 Mon Sep 17 00:00:00 2001 From: "Nicole Bours(Desktop)" Date: Wed, 16 Jun 2021 15:09:26 +0200 Subject: [PATCH 17/19] Fixed toevoegen like --- API/Configuration/MappingProfile.cs | 12 ++++++++++++ API/Extensions/DependencyInjectionExtensions.cs | 3 +++ Repositories/UserProjectCommentLikeRepository.cs | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/API/Configuration/MappingProfile.cs b/API/Configuration/MappingProfile.cs index c14594c9..0ffdedba 100644 --- a/API/Configuration/MappingProfile.cs +++ b/API/Configuration/MappingProfile.cs @@ -62,6 +62,18 @@ public MappingProfile() destination.LikedProject.Description)) .ForAllOtherMembers(member => member.Ignore()); + CreateMap() + .ForMember(source => source.Id, + option => option. + MapFrom(destination => + destination.LikedComment.Id)) + .ForMember(source => source.comment, + option => option + .MapFrom(destination => + destination.LikedComment.Content)) + .ForAllOtherMembers(member => member.Ignore()); + CreateMap(); + CreateMap(); CreateMap() diff --git a/API/Extensions/DependencyInjectionExtensions.cs b/API/Extensions/DependencyInjectionExtensions.cs index d495a09c..3313cd0e 100644 --- a/API/Extensions/DependencyInjectionExtensions.cs +++ b/API/Extensions/DependencyInjectionExtensions.cs @@ -115,6 +115,9 @@ public static IServiceCollection AddServicesAndRepositories(this IServiceCollect services.AddScoped(); services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); services.AddScoped(); diff --git a/Repositories/UserProjectCommentLikeRepository.cs b/Repositories/UserProjectCommentLikeRepository.cs index 635939ea..38c35712 100644 --- a/Repositories/UserProjectCommentLikeRepository.cs +++ b/Repositories/UserProjectCommentLikeRepository.cs @@ -24,7 +24,8 @@ public override void Add(ProjectCommentLike projectCommentLike) bool IUserProjectCommentLikeRepository.CheckIfUserAlreadyLiked(int userId, int projectCommentId) { - ProjectCommentLike projectCommentLike = GetDbSet().SingleOrDefault(comment => comment.CommentLiker.Id == userId && comment.LikedComment.Id == projectCommentId); + ProjectCommentLike projectCommentLike = GetDbSet() + .SingleOrDefault(comment => comment.CommentLiker.Id == userId && comment.LikedComment.Id == projectCommentId); if(projectCommentLike != null) { return true; From 18fb8d02f3042920ec10b0b2ca417bf56a7f5b2e Mon Sep 17 00:00:00 2001 From: "Nicole Bours(Desktop)" Date: Wed, 16 Jun 2021 15:38:21 +0200 Subject: [PATCH 18/19] Update ProjectController.cs --- API/Controllers/ProjectController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/API/Controllers/ProjectController.cs b/API/Controllers/ProjectController.cs index f79fb3ca..ef295e16 100644 --- a/API/Controllers/ProjectController.cs +++ b/API/Controllers/ProjectController.cs @@ -1549,7 +1549,7 @@ public async Task UpdateComment(int projectCommentId, [FromBody] return Ok(mapper.Map(projectComment)); } - [HttpPost("comment/like{projectCommentId}")] + [HttpPost("comment/like/{projectCommentId}")] [Authorize] public async Task LikeProjectComment(int projectCommentId) { @@ -1567,7 +1567,7 @@ public async Task LikeProjectComment(int projectCommentId) }; return NotFound(problemDetails); } - if(!userProjectCommentLikeService.CheckIfUserAlreadyLiked(currentUser.Id, projectCommentId)) + if(userProjectCommentLikeService.CheckIfUserAlreadyLiked(currentUser.Id, projectCommentId)) { ProblemDetails problemDetails = new ProblemDetails { From 4b2cd5eea42f416c0f7d41c097bc87214cb87d00 Mon Sep 17 00:00:00 2001 From: "Nicole Bours(Desktop)" Date: Wed, 16 Jun 2021 15:59:02 +0200 Subject: [PATCH 19/19] Update ProjectCommentRepository.cs --- Repositories/ProjectCommentRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Repositories/ProjectCommentRepository.cs b/Repositories/ProjectCommentRepository.cs index 4ba6bba3..56174d5c 100644 --- a/Repositories/ProjectCommentRepository.cs +++ b/Repositories/ProjectCommentRepository.cs @@ -24,7 +24,7 @@ public ProjectCommentRepository(DbContext dbContext) : base(dbContext) public Task> GetProjectComments(int projectId) { - return DbSet.Where(p => p.ProjectId == projectId).Include(u => u.User) + return DbSet.Where(p => p.ProjectId == projectId).Include(u => u.User).Include(l => l.Likes) .ToListAsync(); }