|
4910 | 4910 | } |
4911 | 4911 | }, |
4912 | 4912 | "response": [] |
| 4913 | + }, |
| 4914 | + { |
| 4915 | + "name": "Unblock unknow", |
| 4916 | + "event": [ |
| 4917 | + { |
| 4918 | + "listen": "test", |
| 4919 | + "script": { |
| 4920 | + "id": "96a0beaa-f104-4ff8-82bd-4df42a27b245", |
| 4921 | + "exec": [ |
| 4922 | + "var response = JSON.parse(responseBody);", |
| 4923 | + "", |
| 4924 | + "", |
| 4925 | + "pm.test(\"Status code is 404\", function () {", |
| 4926 | + " pm.response.to.have.status(404);", |
| 4927 | + "});", |
| 4928 | + "", |
| 4929 | + "tests[\"JSON return code is 404\"] = response.code == 404", |
| 4930 | + "", |
| 4931 | + "tests[\"success is true\"] = response.success == false", |
| 4932 | + "tests[\"Message is correct\"] = response.error.message == \"User -1 not found.\"", |
| 4933 | + "tests[\"Error type is Bad Request\"] = response.error.type == \"NotFoundError\"" |
| 4934 | + ], |
| 4935 | + "type": "text/javascript" |
| 4936 | + } |
| 4937 | + } |
| 4938 | + ], |
| 4939 | + "request": { |
| 4940 | + "method": "POST", |
| 4941 | + "header": [], |
| 4942 | + "url": { |
| 4943 | + "raw": "{{host}}/profile/unblock/-1", |
| 4944 | + "host": [ |
| 4945 | + "{{host}}" |
| 4946 | + ], |
| 4947 | + "path": [ |
| 4948 | + "profile", |
| 4949 | + "unblock", |
| 4950 | + "-1" |
| 4951 | + ] |
| 4952 | + } |
| 4953 | + }, |
| 4954 | + "response": [] |
| 4955 | + }, |
| 4956 | + { |
| 4957 | + "name": "Unblock user 1500", |
| 4958 | + "event": [ |
| 4959 | + { |
| 4960 | + "listen": "test", |
| 4961 | + "script": { |
| 4962 | + "id": "b5670637-b5cb-4117-b130-39cc7922b23c", |
| 4963 | + "exec": [ |
| 4964 | + "var response = JSON.parse(responseBody);", |
| 4965 | + "", |
| 4966 | + "", |
| 4967 | + "pm.test(\"Status code is 200\", function () {", |
| 4968 | + " pm.response.to.have.status(200);", |
| 4969 | + "});", |
| 4970 | + "", |
| 4971 | + "tests[\"Success is true\"] = response.success == true", |
| 4972 | + "tests[\"Message is correct\"] = response.message == \"Unblock successful.\"", |
| 4973 | + "" |
| 4974 | + ], |
| 4975 | + "type": "text/javascript" |
| 4976 | + } |
| 4977 | + } |
| 4978 | + ], |
| 4979 | + "request": { |
| 4980 | + "method": "POST", |
| 4981 | + "header": [], |
| 4982 | + "url": { |
| 4983 | + "raw": "{{host}}/profile/unblock/1500", |
| 4984 | + "host": [ |
| 4985 | + "{{host}}" |
| 4986 | + ], |
| 4987 | + "path": [ |
| 4988 | + "profile", |
| 4989 | + "unblock", |
| 4990 | + "1500" |
| 4991 | + ] |
| 4992 | + } |
| 4993 | + }, |
| 4994 | + "response": [] |
| 4995 | + }, |
| 4996 | + { |
| 4997 | + "name": "Double unblock", |
| 4998 | + "event": [ |
| 4999 | + { |
| 5000 | + "listen": "test", |
| 5001 | + "script": { |
| 5002 | + "id": "252fd8b0-535d-49df-bc9a-e432515a602a", |
| 5003 | + "exec": [ |
| 5004 | + "var response = JSON.parse(responseBody);", |
| 5005 | + "", |
| 5006 | + "", |
| 5007 | + "pm.test(\"Status code is 400\", function () {", |
| 5008 | + " pm.response.to.have.status(400);", |
| 5009 | + "});", |
| 5010 | + "", |
| 5011 | + "tests[\"JSON return code is 400\"] = response.code == 400", |
| 5012 | + "", |
| 5013 | + "tests[\"success is true\"] = response.success == false", |
| 5014 | + "tests[\"Message is correct\"] = response.error.message == \"You didn't block this user.\"", |
| 5015 | + "tests[\"Error type is Bad Request\"] = response.error.type == \"BadRequestError\"" |
| 5016 | + ], |
| 5017 | + "type": "text/javascript" |
| 5018 | + } |
| 5019 | + } |
| 5020 | + ], |
| 5021 | + "request": { |
| 5022 | + "method": "POST", |
| 5023 | + "header": [], |
| 5024 | + "url": { |
| 5025 | + "raw": "{{host}}/profile/unblock/1500", |
| 5026 | + "host": [ |
| 5027 | + "{{host}}" |
| 5028 | + ], |
| 5029 | + "path": [ |
| 5030 | + "profile", |
| 5031 | + "unblock", |
| 5032 | + "1500" |
| 5033 | + ] |
| 5034 | + } |
| 5035 | + }, |
| 5036 | + "response": [] |
| 5037 | + }, |
| 5038 | + { |
| 5039 | + "name": "Search after unblock", |
| 5040 | + "event": [ |
| 5041 | + { |
| 5042 | + "listen": "test", |
| 5043 | + "script": { |
| 5044 | + "id": "175e190a-98af-43cd-85ab-1f1e5daaf0a5", |
| 5045 | + "exec": [ |
| 5046 | + "var response = JSON.parse(responseBody);", |
| 5047 | + "", |
| 5048 | + "", |
| 5049 | + "pm.test(\"Status code is 200\", function () {", |
| 5050 | + " pm.response.to.have.status(200);", |
| 5051 | + "});", |
| 5052 | + "", |
| 5053 | + "tests[\"Success is true\"] = response.success == true", |
| 5054 | + "", |
| 5055 | + "if (response.search_results.length != 0) {", |
| 5056 | + " tests[\"User 1500 is in search\"] = false", |
| 5057 | + " for (var i = 0; i < response.search_results.length; i++) {", |
| 5058 | + " user = response.search_results[i]", |
| 5059 | + " if (user.id == 1500) {", |
| 5060 | + " tests[\"User 1500 is in search\"] = true", |
| 5061 | + " break", |
| 5062 | + " }", |
| 5063 | + " }", |
| 5064 | + "}" |
| 5065 | + ], |
| 5066 | + "type": "text/javascript" |
| 5067 | + } |
| 5068 | + } |
| 5069 | + ], |
| 5070 | + "request": { |
| 5071 | + "method": "POST", |
| 5072 | + "header": [], |
| 5073 | + "body": { |
| 5074 | + "mode": "raw", |
| 5075 | + "raw": "{\n \"min_age\": -1,\n \"max_age\": -1,\n \"min_score\": -1,\n \"max_score\": -1,\n \"tags\": [],\n \"max_distance\": -1\n}", |
| 5076 | + "options": { |
| 5077 | + "raw": { |
| 5078 | + "language": "json" |
| 5079 | + } |
| 5080 | + } |
| 5081 | + }, |
| 5082 | + "url": { |
| 5083 | + "raw": "{{host}}/search", |
| 5084 | + "host": [ |
| 5085 | + "{{host}}" |
| 5086 | + ], |
| 5087 | + "path": [ |
| 5088 | + "search" |
| 5089 | + ] |
| 5090 | + } |
| 5091 | + }, |
| 5092 | + "response": [] |
| 5093 | + }, |
| 5094 | + { |
| 5095 | + "name": "Force recommendations after unblock", |
| 5096 | + "event": [ |
| 5097 | + { |
| 5098 | + "listen": "test", |
| 5099 | + "script": { |
| 5100 | + "id": "a97db51f-4ea1-4622-bfbd-6e1172ac51a3", |
| 5101 | + "exec": [ |
| 5102 | + "var response = JSON.parse(responseBody);", |
| 5103 | + "", |
| 5104 | + "", |
| 5105 | + "pm.test(\"Status code is 200\", function () {", |
| 5106 | + " pm.response.to.have.status(200);", |
| 5107 | + "});", |
| 5108 | + "", |
| 5109 | + "tests[\"JSON return code is 200\"] = response.code == 200", |
| 5110 | + "", |
| 5111 | + "tests[\"success is true\"] = response.success == true", |
| 5112 | + "", |
| 5113 | + "if (response.recommendations.length != 0) {", |
| 5114 | + " tests[\"User 1500 is in recommendations\"] = false", |
| 5115 | + " for (var i = 0; i < response.recommendations.length; i++) {", |
| 5116 | + " user = response.recommendations[i]", |
| 5117 | + " if (user.id == 1500) {", |
| 5118 | + " tests[\"User 1500 is in recommendations\"] = true", |
| 5119 | + " break", |
| 5120 | + " }", |
| 5121 | + " }", |
| 5122 | + "}" |
| 5123 | + ], |
| 5124 | + "type": "text/javascript" |
| 5125 | + } |
| 5126 | + } |
| 5127 | + ], |
| 5128 | + "protocolProfileBehavior": { |
| 5129 | + "disableBodyPruning": true |
| 5130 | + }, |
| 5131 | + "request": { |
| 5132 | + "method": "GET", |
| 5133 | + "header": [], |
| 5134 | + "body": { |
| 5135 | + "mode": "raw", |
| 5136 | + "raw": "{\n \"force\": true\n}", |
| 5137 | + "options": { |
| 5138 | + "raw": { |
| 5139 | + "language": "json" |
| 5140 | + } |
| 5141 | + } |
| 5142 | + }, |
| 5143 | + "url": { |
| 5144 | + "raw": "{{host}}/recommendations", |
| 5145 | + "host": [ |
| 5146 | + "{{host}}" |
| 5147 | + ], |
| 5148 | + "path": [ |
| 5149 | + "recommendations" |
| 5150 | + ] |
| 5151 | + } |
| 5152 | + }, |
| 5153 | + "response": [] |
4913 | 5154 | } |
4914 | 5155 | ], |
4915 | 5156 | "protocolProfileBehavior": {} |
|
0 commit comments