dfa0aad5b7d45efcb9eb202f5846a24de4ed3f90
[integration.git] / test / postman / 01_Onboard_Vendor.postman_collection.json
1 {
2         "variables": [],
3         "info": {
4                 "name": "01_Onboard_Vendor",
5                 "_postman_id": "f646198b-2f39-fb4f-c550-7c703688ac85",
6                 "description": "onboard new vendor",
7                 "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
8         },
9         "item": [
10                 {
11                         "name": "Get Vendor before create",
12                         "event": [
13                                 {
14                                         "listen": "test",
15                                         "script": {
16                                                 "type": "text/javascript",
17                                                 "exec": [
18                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
19                                                         "",
20                                                         "var jsonData = JSON.parse(responseBody);",
21                                                         "var vendor_found = false;",
22                                                         "for (var i = 0; i < jsonData.results.length; i++) { ",
23                                                         "   if (jsonData.results[i][\"name\"] === postman.getGlobalVariable(\"vendor_name\")) {",
24                                                         "       vendor_found = true;",
25                                                         "       postman.setGlobalVariable(\"auto_vendor_id\", \"\"+jsonData.results[i][\"id\"]+\"\");",
26                                                         "   }",
27                                                         "}",
28                                                         "if (vendor_found === false) {",
29                                                         "    tests[postman.getGlobalVariable(\"vendor_name\")+\" does not exists\"] = true;",
30                                                         "}",
31                                                         "",
32                                                         "else {",
33                                                         "    tests[postman.getGlobalVariable(\"vendor_name\")+\" already exists, we stop the run\"] = true;",
34                                                         "    postman.setNextRequest(null);",
35                                                         "}",
36                                                         ""
37                                                 ]
38                                         }
39                                 }
40                         ],
41                         "request": {
42                                 "url": "{{url-sdc2}}/sdc1/feProxy/onboarding-api/v1.0/vendor-license-models",
43                                 "method": "GET",
44                                 "header": [
45                                         {
46                                                 "key": "Content-Type",
47                                                 "value": "application/json",
48                                                 "description": ""
49                                         },
50                                         {
51                                                 "key": "Accept",
52                                                 "value": "application/json",
53                                                 "description": ""
54                                         },
55                                         {
56                                                 "key": "X-TransactionId",
57                                                 "value": "robot-ete-ba84612d-c1c6-4c53-9967-7b1dff276c7a",
58                                                 "description": ""
59                                         },
60                                         {
61                                                 "key": "USER_ID",
62                                                 "value": "cs0008",
63                                                 "description": ""
64                                         },
65                                         {
66                                                 "key": "X-FromAppId",
67                                                 "value": "robot-ete",
68                                                 "description": ""
69                                         }
70                                 ],
71                                 "body": {
72                                         "mode": "raw",
73                                         "raw": "{\"iconRef\": \"icon\", \"vendorName\": \"test-api-license-model\", \"description\": \"vendor license model\"}"
74                                 },
75                                 "description": ""
76                         },
77                         "response": []
78                 },
79                 {
80                         "name": "Create Vendor",
81                         "event": [
82                                 {
83                                         "listen": "test",
84                                         "script": {
85                                                 "type": "text/javascript",
86                                                 "exec": [
87                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
88                                                         "",
89                                                         "var jsonData = JSON.parse(responseBody);",
90                                                         "postman.setGlobalVariable(\"auto_vendor_id\", \"\"+jsonData[\"itemId\"]+\"\");",
91                                                         "postman.setGlobalVariable(\"auto_vendor_version_id\", \"\"+jsonData[\"version\"][\"id\"]+\"\");",
92                                                         "",
93                                                         "var jsonData = JSON.parse(responseBody);",
94                                                         "tests[\"Vendor version is in Draft status\"] = jsonData[\"version\"][\"status\"] === \"Draft\";"
95                                                 ]
96                                         }
97                                 }
98                         ],
99                         "request": {
100                                 "url": "{{url-sdc2}}/sdc1/feProxy/onboarding-api/v1.0/vendor-license-models",
101                                 "method": "POST",
102                                 "header": [
103                                         {
104                                                 "key": "Content-Type",
105                                                 "value": "application/json",
106                                                 "description": ""
107                                         },
108                                         {
109                                                 "key": "Accept",
110                                                 "value": "application/json",
111                                                 "description": ""
112                                         },
113                                         {
114                                                 "key": "X-TransactionId",
115                                                 "value": "robot-ete-ba84612d-c1c6-4c53-9967-7b1dff276c7a",
116                                                 "description": ""
117                                         },
118                                         {
119                                                 "key": "USER_ID",
120                                                 "value": "cs0008",
121                                                 "description": ""
122                                         },
123                                         {
124                                                 "key": "X-FromAppId",
125                                                 "value": "robot-ete",
126                                                 "description": ""
127                                         }
128                                 ],
129                                 "body": {
130                                         "mode": "raw",
131                                         "raw": "{\r\n  \"iconRef\": \"icon\",\r\n  \"vendorName\": \"{{vendor_name}}\",\r\n  \"description\": \"Vendor\"\r\n}"
132                                 },
133                                 "description": ""
134                         },
135                         "response": []
136                 },
137                 {
138                         "name": "Get Vendor after create",
139                         "event": [
140                                 {
141                                         "listen": "test",
142                                         "script": {
143                                                 "type": "text/javascript",
144                                                 "exec": [
145                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
146                                                         "",
147                                                         "var jsonData = JSON.parse(responseBody);",
148                                                         "var vendor_found = false;",
149                                                         "for (var i = 0; i < jsonData.results.length; i++) { ",
150                                                         "   if (jsonData.results[i][\"name\"] === postman.getGlobalVariable(\"vendor_name\")) {",
151                                                         "       vendor_found = true;",
152                                                         "       postman.setGlobalVariable(\"auto_vendor_id\", \"\"+jsonData.results[i][\"id\"]+\"\");",
153                                                         "   }",
154                                                         "}",
155                                                         "tests[postman.getGlobalVariable(\"vendor_name\")+\" found\"] = vendor_found === true;",
156                                                         "",
157                                                         "",
158                                                         ""
159                                                 ]
160                                         }
161                                 }
162                         ],
163                         "request": {
164                                 "url": "{{url-sdc2}}/sdc1/feProxy/onboarding-api/v1.0/vendor-license-models",
165                                 "method": "GET",
166                                 "header": [
167                                         {
168                                                 "key": "Content-Type",
169                                                 "value": "application/json",
170                                                 "description": ""
171                                         },
172                                         {
173                                                 "key": "Accept",
174                                                 "value": "application/json",
175                                                 "description": ""
176                                         },
177                                         {
178                                                 "key": "X-TransactionId",
179                                                 "value": "robot-ete-ba84612d-c1c6-4c53-9967-7b1dff276c7a",
180                                                 "description": ""
181                                         },
182                                         {
183                                                 "key": "USER_ID",
184                                                 "value": "cs0008",
185                                                 "description": ""
186                                         },
187                                         {
188                                                 "key": "X-FromAppId",
189                                                 "value": "robot-ete",
190                                                 "description": ""
191                                         }
192                                 ],
193                                 "body": {
194                                         "mode": "raw",
195                                         "raw": "{\"iconRef\": \"icon\", \"vendorName\": \"test-api-license-model\", \"description\": \"vendor license model\"}"
196                                 },
197                                 "description": ""
198                         },
199                         "response": []
200                 },
201                 {
202                         "name": "Get Vendor additional info after create",
203                         "event": [
204                                 {
205                                         "listen": "test",
206                                         "script": {
207                                                 "type": "text/javascript",
208                                                 "exec": [
209                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
210                                                         "",
211                                                         "",
212                                                         "",
213                                                         ""
214                                                 ]
215                                         }
216                                 }
217                         ],
218                         "request": {
219                                 "url": "{{url-sdc2}}/sdc1/feProxy/onboarding-api/v1.0/items/{{auto_vendor_id}}/versions",
220                                 "method": "GET",
221                                 "header": [
222                                         {
223                                                 "key": "Content-Type",
224                                                 "value": "application/json",
225                                                 "description": ""
226                                         },
227                                         {
228                                                 "key": "Accept",
229                                                 "value": "application/json",
230                                                 "description": ""
231                                         },
232                                         {
233                                                 "key": "X-TransactionId",
234                                                 "value": "robot-ete-ba84612d-c1c6-4c53-9967-7b1dff276c7a",
235                                                 "description": ""
236                                         },
237                                         {
238                                                 "key": "USER_ID",
239                                                 "value": "cs0008",
240                                                 "description": ""
241                                         },
242                                         {
243                                                 "key": "X-FromAppId",
244                                                 "value": "robot-ete",
245                                                 "description": ""
246                                         }
247                                 ],
248                                 "body": {
249                                         "mode": "raw",
250                                         "raw": "{\"iconRef\": \"icon\", \"vendorName\": \"test-api-license-model\", \"description\": \"vendor license model\"}"
251                                 },
252                                 "description": ""
253                         },
254                         "response": []
255                 },
256                 {
257                         "name": "Submit Vendor",
258                         "event": [
259                                 {
260                                         "listen": "test",
261                                         "script": {
262                                                 "type": "text/javascript",
263                                                 "exec": [
264                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
265                                                         "",
266                                                         ""
267                                                 ]
268                                         }
269                                 }
270                         ],
271                         "request": {
272                                 "url": "{{url-sdc2}}/sdc1/feProxy/onboarding-api/v1.0/vendor-license-models/{{auto_vendor_id}}/versions/{{auto_vendor_version_id}}/actions",
273                                 "method": "PUT",
274                                 "header": [
275                                         {
276                                                 "key": "Content-Type",
277                                                 "value": "application/json",
278                                                 "description": ""
279                                         },
280                                         {
281                                                 "key": "Accept",
282                                                 "value": "application/json",
283                                                 "description": ""
284                                         },
285                                         {
286                                                 "key": "X-TransactionId",
287                                                 "value": "robot-ete-ba84612d-c1c6-4c53-9967-7b1dff276c7a",
288                                                 "description": ""
289                                         },
290                                         {
291                                                 "key": "USER_ID",
292                                                 "value": "cs0008",
293                                                 "description": ""
294                                         },
295                                         {
296                                                 "key": "X-FromAppId",
297                                                 "value": "robot-ete",
298                                                 "description": ""
299                                         }
300                                 ],
301                                 "body": {
302                                         "mode": "raw",
303                                         "raw": "{\"action\":\"Submit\"}"
304                                 },
305                                 "description": ""
306                         },
307                         "response": []
308                 },
309                 {
310                         "name": "Get Vendor after submit",
311                         "event": [
312                                 {
313                                         "listen": "test",
314                                         "script": {
315                                                 "type": "text/javascript",
316                                                 "exec": [
317                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
318                                                         "",
319                                                         "",
320                                                         "",
321                                                         ""
322                                                 ]
323                                         }
324                                 }
325                         ],
326                         "request": {
327                                 "url": "{{url-sdc2}}/sdc1/feProxy/onboarding-api/v1.0/vendor-license-models",
328                                 "method": "GET",
329                                 "header": [
330                                         {
331                                                 "key": "Content-Type",
332                                                 "value": "application/json",
333                                                 "description": ""
334                                         },
335                                         {
336                                                 "key": "Accept",
337                                                 "value": "application/json",
338                                                 "description": ""
339                                         },
340                                         {
341                                                 "key": "X-TransactionId",
342                                                 "value": "robot-ete-ba84612d-c1c6-4c53-9967-7b1dff276c7a",
343                                                 "description": ""
344                                         },
345                                         {
346                                                 "key": "USER_ID",
347                                                 "value": "cs0008",
348                                                 "description": ""
349                                         },
350                                         {
351                                                 "key": "X-FromAppId",
352                                                 "value": "robot-ete",
353                                                 "description": ""
354                                         }
355                                 ],
356                                 "body": {
357                                         "mode": "raw",
358                                         "raw": "{\"iconRef\": \"icon\", \"vendorName\": \"test-api-license-model\", \"description\": \"vendor license model\"}"
359                                 },
360                                 "description": ""
361                         },
362                         "response": []
363                 },
364                 {
365                         "name": "Get Vendor additional info after Submit",
366                         "event": [
367                                 {
368                                         "listen": "test",
369                                         "script": {
370                                                 "type": "text/javascript",
371                                                 "exec": [
372                                                         "tests[\"Status code is 200\"] = responseCode.code === 200;",
373                                                         "",
374                                                         "var jsonData = JSON.parse(responseBody);",
375                                                         "",
376                                                         "tests[\"Vendor version is in Draft status\"] = jsonData[\"status\"] === \"Certified\";",
377                                                         ""
378                                                 ]
379                                         }
380                                 }
381                         ],
382                         "request": {
383                                 "url": "{{url-sdc2}}/sdc1/feProxy/onboarding-api/v1.0/items/{{auto_vendor_id}}/versions/{{auto_vendor_version_id}}",
384                                 "method": "GET",
385                                 "header": [
386                                         {
387                                                 "key": "Content-Type",
388                                                 "value": "application/json",
389                                                 "description": ""
390                                         },
391                                         {
392                                                 "key": "Accept",
393                                                 "value": "application/json",
394                                                 "description": ""
395                                         },
396                                         {
397                                                 "key": "X-TransactionId",
398                                                 "value": "robot-ete-ba84612d-c1c6-4c53-9967-7b1dff276c7a",
399                                                 "description": ""
400                                         },
401                                         {
402                                                 "key": "USER_ID",
403                                                 "value": "cs0008",
404                                                 "description": ""
405                                         },
406                                         {
407                                                 "key": "X-FromAppId",
408                                                 "value": "robot-ete",
409                                                 "description": ""
410                                         }
411                                 ],
412                                 "body": {
413                                         "mode": "raw",
414                                         "raw": "{\"iconRef\": \"icon\", \"vendorName\": \"test-api-license-model\", \"description\": \"vendor license model\"}"
415                                 },
416                                 "description": ""
417                         },
418                         "response": []
419                 }
420         ]
421 }