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