Rene Robert | 53ef77f | 2019-01-24 18:24:55 +0100 | [diff] [blame] | 1 | { |
Bartek Grzybowski | 2ab4281 | 2020-02-26 15:07:39 +0100 | [diff] [blame] | 2 | "info": { |
| 3 | "_postman_id": "338c7225-c4d5-40c8-8619-ae904f41a83d", |
| 4 | "name": "01_Onboard_Vendor", |
| 5 | "description": "onboard new vendor", |
| 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" |
| 7 | }, |
| 8 | "item": [ |
| 9 | { |
| 10 | "name": "Get Vendor before create", |
| 11 | "event": [ |
| 12 | { |
| 13 | "listen": "test", |
| 14 | "script": { |
| 15 | "id": "2249b072-2689-45f3-87ea-a75da5802752", |
| 16 | "exec": [ |
| 17 | "pm.test(\"Status code is 200\", function () {", |
| 18 | " pm.response.to.have.status(200);", |
| 19 | "});", |
| 20 | "", |
| 21 | "var jsonData = pm.response.json();", |
| 22 | "", |
| 23 | "var vendor_found = false;", |
| 24 | "for (var i = 0; i < jsonData.results.length; i++) { ", |
| 25 | " if (jsonData.results[i].name === pm.environment.get(\"vendor_name\")) {", |
| 26 | " vendor_found = true;", |
| 27 | " pm.environment.set(\"auto_vendor_id\", \"\"+jsonData.results[i].id+\"\");", |
| 28 | " }", |
| 29 | "}", |
| 30 | "if (vendor_found === false) {", |
| 31 | " tests[pm.environment.get(\"vendor_name\")+\" not yet declared\"] = true;", |
| 32 | "}", |
| 33 | "", |
| 34 | "else {", |
| 35 | " tests[pm.environment.get(\"vendor_name\")+\" already exists, we stop the run\"] = false;", |
| 36 | " postman.setNextRequest(null);", |
| 37 | "}", |
| 38 | "" |
| 39 | ], |
| 40 | "type": "text/javascript" |
| 41 | } |
| 42 | } |
| 43 | ], |
| 44 | "request": { |
| 45 | "method": "GET", |
| 46 | "header": [ |
| 47 | { |
| 48 | "key": "Content-Type", |
| 49 | "value": "application/json" |
| 50 | }, |
| 51 | { |
| 52 | "key": "Accept", |
| 53 | "value": "application/json" |
| 54 | }, |
| 55 | { |
| 56 | "key": "X-TransactionId", |
| 57 | "value": "robot-ete-ba84612d-c1c6-4c53-9967-7b1dff276c7a" |
| 58 | }, |
| 59 | { |
| 60 | "key": "USER_ID", |
| 61 | "value": "cs0008" |
| 62 | }, |
| 63 | { |
| 64 | "key": "X-FromAppId", |
| 65 | "value": "robot-ete" |
| 66 | } |
| 67 | ], |
| 68 | "body": { |
| 69 | "mode": "raw", |
| 70 | "raw": "" |
| 71 | }, |
| 72 | "url": { |
| 73 | "raw": "{{url-sdc2}}/sdc1/feProxy/onboarding-api/v1.0/vendor-license-models", |
| 74 | "host": [ |
| 75 | "{{url-sdc2}}" |
| 76 | ], |
| 77 | "path": [ |
| 78 | "sdc1", |
| 79 | "feProxy", |
| 80 | "onboarding-api", |
| 81 | "v1.0", |
| 82 | "vendor-license-models" |
| 83 | ] |
| 84 | } |
| 85 | }, |
| 86 | "response": [] |
| 87 | }, |
| 88 | { |
| 89 | "name": "Create Vendor", |
| 90 | "event": [ |
| 91 | { |
| 92 | "listen": "test", |
| 93 | "script": { |
| 94 | "id": "80c1d190-d480-4150-ae91-8ce4111c0f9d", |
| 95 | "exec": [ |
| 96 | "pm.test(\"Status code is 200\", function () {", |
| 97 | " pm.response.to.have.status(200);", |
| 98 | "});", |
| 99 | "", |
| 100 | "var jsonData = pm.response.json();", |
| 101 | "", |
| 102 | "pm.environment.set(\"auto_vendor_id\", \"\"+jsonData.itemId+\"\");", |
| 103 | "pm.environment.set(\"auto_vendor_version_id\", \"\"+jsonData.version.id+\"\");", |
| 104 | "", |
| 105 | "tests[\"Vendor status is : \"+jsonData.version.status] = jsonData.version.status === \"Draft\";" |
| 106 | ], |
| 107 | "type": "text/javascript" |
| 108 | } |
| 109 | } |
| 110 | ], |
| 111 | "request": { |
| 112 | "method": "POST", |
| 113 | "header": [ |
| 114 | { |
| 115 | "key": "Content-Type", |
| 116 | "value": "application/json" |
| 117 | }, |
| 118 | { |
| 119 | "key": "Accept", |
| 120 | "value": "application/json" |
| 121 | }, |
| 122 | { |
| 123 | "key": "X-TransactionId", |
| 124 | "value": "robot-ete-ba84612d-c1c6-4c53-9967-7b1dff276c7a" |
| 125 | }, |
| 126 | { |
| 127 | "key": "USER_ID", |
| 128 | "value": "cs0008" |
| 129 | }, |
| 130 | { |
| 131 | "key": "X-FromAppId", |
| 132 | "value": "robot-ete" |
| 133 | } |
| 134 | ], |
| 135 | "body": { |
| 136 | "mode": "raw", |
| 137 | "raw": "{\r\n \"iconRef\": \"icon\",\r\n \"vendorName\": \"{{vendor_name}}\",\r\n \"description\": \"Vendor\"\r\n}" |
| 138 | }, |
| 139 | "url": { |
| 140 | "raw": "{{url-sdc2}}/sdc1/feProxy/onboarding-api/v1.0/vendor-license-models", |
| 141 | "host": [ |
| 142 | "{{url-sdc2}}" |
| 143 | ], |
| 144 | "path": [ |
| 145 | "sdc1", |
| 146 | "feProxy", |
| 147 | "onboarding-api", |
| 148 | "v1.0", |
| 149 | "vendor-license-models" |
| 150 | ] |
| 151 | } |
| 152 | }, |
| 153 | "response": [] |
| 154 | }, |
| 155 | { |
| 156 | "name": "Get Vendor after create", |
| 157 | "event": [ |
| 158 | { |
| 159 | "listen": "test", |
| 160 | "script": { |
| 161 | "id": "aa6fd7c5-c941-43ce-8300-a492c2d62a6c", |
| 162 | "exec": [ |
| 163 | "pm.test(\"Status code is 200\", function () {", |
| 164 | " pm.response.to.have.status(200);", |
| 165 | "});", |
| 166 | "", |
| 167 | "var jsonData = pm.response.json();", |
| 168 | "", |
| 169 | "var vendor_found = false;", |
| 170 | "for (var i = 0; i < jsonData.results.length; i++) { ", |
| 171 | " if (jsonData.results[i].name === pm.environment.get(\"vendor_name\")) {", |
| 172 | " vendor_found = true;", |
| 173 | " pm.environment.set(\"auto_vendor_id\", \"\"+jsonData.results[i].id+\"\");", |
| 174 | " }", |
| 175 | "}", |
| 176 | "tests[pm.environment.get(\"vendor_name\")+\" found\"] = vendor_found === vendor_found;", |
| 177 | "", |
| 178 | "", |
| 179 | "" |
| 180 | ], |
| 181 | "type": "text/javascript" |
| 182 | } |
| 183 | } |
| 184 | ], |
| 185 | "request": { |
| 186 | "method": "GET", |
| 187 | "header": [ |
| 188 | { |
| 189 | "key": "Content-Type", |
| 190 | "value": "application/json" |
| 191 | }, |
| 192 | { |
| 193 | "key": "Accept", |
| 194 | "value": "application/json" |
| 195 | }, |
| 196 | { |
| 197 | "key": "X-TransactionId", |
| 198 | "value": "robot-ete-ba84612d-c1c6-4c53-9967-7b1dff276c7a" |
| 199 | }, |
| 200 | { |
| 201 | "key": "USER_ID", |
| 202 | "value": "cs0008" |
| 203 | }, |
| 204 | { |
| 205 | "key": "X-FromAppId", |
| 206 | "value": "robot-ete" |
| 207 | } |
| 208 | ], |
| 209 | "body": { |
| 210 | "mode": "raw", |
| 211 | "raw": "" |
| 212 | }, |
| 213 | "url": { |
| 214 | "raw": "{{url-sdc2}}/sdc1/feProxy/onboarding-api/v1.0/vendor-license-models", |
| 215 | "host": [ |
| 216 | "{{url-sdc2}}" |
| 217 | ], |
| 218 | "path": [ |
| 219 | "sdc1", |
| 220 | "feProxy", |
| 221 | "onboarding-api", |
| 222 | "v1.0", |
| 223 | "vendor-license-models" |
| 224 | ] |
| 225 | } |
| 226 | }, |
| 227 | "response": [] |
| 228 | }, |
| 229 | { |
| 230 | "name": "Submit Vendor", |
| 231 | "event": [ |
| 232 | { |
| 233 | "listen": "test", |
| 234 | "script": { |
| 235 | "id": "db905800-2754-491a-9d78-1ffebc12fb18", |
| 236 | "exec": [ |
| 237 | "pm.test(\"Status code is 200\", function () {", |
| 238 | " pm.response.to.have.status(200);", |
| 239 | "});", |
| 240 | "" |
| 241 | ], |
| 242 | "type": "text/javascript" |
| 243 | } |
| 244 | } |
| 245 | ], |
| 246 | "request": { |
| 247 | "method": "PUT", |
| 248 | "header": [ |
| 249 | { |
| 250 | "key": "Content-Type", |
| 251 | "value": "application/json" |
| 252 | }, |
| 253 | { |
| 254 | "key": "Accept", |
| 255 | "value": "application/json" |
| 256 | }, |
| 257 | { |
| 258 | "key": "X-TransactionId", |
| 259 | "value": "robot-ete-ba84612d-c1c6-4c53-9967-7b1dff276c7a" |
| 260 | }, |
| 261 | { |
| 262 | "key": "USER_ID", |
| 263 | "value": "cs0008" |
| 264 | }, |
| 265 | { |
| 266 | "key": "X-FromAppId", |
| 267 | "value": "robot-ete" |
| 268 | } |
| 269 | ], |
| 270 | "body": { |
| 271 | "mode": "raw", |
| 272 | "raw": "{\"action\":\"Submit\"}" |
| 273 | }, |
| 274 | "url": { |
| 275 | "raw": "{{url-sdc2}}/sdc1/feProxy/onboarding-api/v1.0/vendor-license-models/{{auto_vendor_id}}/versions/{{auto_vendor_version_id}}/actions", |
| 276 | "host": [ |
| 277 | "{{url-sdc2}}" |
| 278 | ], |
| 279 | "path": [ |
| 280 | "sdc1", |
| 281 | "feProxy", |
| 282 | "onboarding-api", |
| 283 | "v1.0", |
| 284 | "vendor-license-models", |
| 285 | "{{auto_vendor_id}}", |
| 286 | "versions", |
| 287 | "{{auto_vendor_version_id}}", |
| 288 | "actions" |
| 289 | ] |
| 290 | } |
| 291 | }, |
| 292 | "response": [] |
| 293 | }, |
| 294 | { |
| 295 | "name": "Get Vendor additional info after Submit", |
| 296 | "event": [ |
| 297 | { |
| 298 | "listen": "test", |
| 299 | "script": { |
| 300 | "id": "f9003c80-add1-4581-9a9d-661972f7d6d5", |
| 301 | "exec": [ |
| 302 | "pm.test(\"Status code is 200\", function () {", |
| 303 | " pm.response.to.have.status(200);", |
| 304 | "});", |
| 305 | "", |
| 306 | "var jsonData = pm.response.json();", |
| 307 | "", |
| 308 | "tests[\"Vendor is : \"+jsonData.status] = jsonData.status === \"Certified\";", |
| 309 | "" |
| 310 | ], |
| 311 | "type": "text/javascript" |
| 312 | } |
| 313 | } |
| 314 | ], |
| 315 | "request": { |
| 316 | "method": "GET", |
| 317 | "header": [ |
| 318 | { |
| 319 | "key": "Content-Type", |
| 320 | "value": "application/json" |
| 321 | }, |
| 322 | { |
| 323 | "key": "Accept", |
| 324 | "value": "application/json" |
| 325 | }, |
| 326 | { |
| 327 | "key": "X-TransactionId", |
| 328 | "value": "robot-ete-ba84612d-c1c6-4c53-9967-7b1dff276c7a" |
| 329 | }, |
| 330 | { |
| 331 | "key": "USER_ID", |
| 332 | "value": "cs0008" |
| 333 | }, |
| 334 | { |
| 335 | "key": "X-FromAppId", |
| 336 | "value": "robot-ete" |
| 337 | } |
| 338 | ], |
| 339 | "body": { |
| 340 | "mode": "raw", |
| 341 | "raw": "" |
| 342 | }, |
| 343 | "url": { |
| 344 | "raw": "{{url-sdc2}}/sdc1/feProxy/onboarding-api/v1.0/items/{{auto_vendor_id}}/versions/{{auto_vendor_version_id}}", |
| 345 | "host": [ |
| 346 | "{{url-sdc2}}" |
| 347 | ], |
| 348 | "path": [ |
| 349 | "sdc1", |
| 350 | "feProxy", |
| 351 | "onboarding-api", |
| 352 | "v1.0", |
| 353 | "items", |
| 354 | "{{auto_vendor_id}}", |
| 355 | "versions", |
| 356 | "{{auto_vendor_version_id}}" |
| 357 | ] |
| 358 | } |
| 359 | }, |
| 360 | "response": [] |
| 361 | } |
| 362 | ] |
| 363 | } |