Skip to content

Commit 92c055e

Browse files
Merge pull request #167 from topcoder-platform/add-postman-for-processors
Add postman collection to test the legacy processor
2 parents 4825070 + a6373fd commit 92c055e

File tree

2 files changed

+289
-0
lines changed

2 files changed

+289
-0
lines changed
Lines changed: 265 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
1+
{
2+
"info": {
3+
"_postman_id": "4ce83573-7d66-4f37-a968-52c1f4bfdc5d",
4+
"name": "Challenge V5 Test processor",
5+
"description": "Test API to see if processors are working.\n\n- [ ] Create a challenge using v5 API, make sure it goes back into v4 correctly\n- [ ] Review the legacy processor to make sure the updated properties correctly update v5 data. The following properties must be updated when a challenge gets created on legacy by the processor:\n - [ ] `legacy.directProjectId`\n - [ ] `legacy.forumId`\n - [ ] `legacy.informixModified`\n - [ ] `legacyId`",
6+
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
7+
},
8+
"item": [
9+
{
10+
"name": "Create a new challenge with only basic info",
11+
"event": [
12+
{
13+
"listen": "test",
14+
"script": {
15+
"id": "b67c86f1-6a2d-42cb-a4da-ab69a63f9f67",
16+
"exec": [
17+
"var jsonData = pm.response.json();",
18+
"pm.environment.set(\"CHALLENGE_ID\", jsonData.id);",
19+
""
20+
],
21+
"type": "text/javascript"
22+
}
23+
}
24+
],
25+
"request": {
26+
"method": "POST",
27+
"header": [
28+
{
29+
"key": "Authorization",
30+
"type": "text",
31+
"value": "Bearer {{TOKEN}}"
32+
}
33+
],
34+
"body": {
35+
"mode": "raw",
36+
"raw": "{\n\t\"typeId\": \"e885273d-aeda-42c0-917d-bfbf979afbba\",\n\t\"name\": \"Thomas final test challenge 11 June\",\n\t\"projectId\": 16531,\n\t\"status\": \"New\",\n\t\"terms\": []\n}",
37+
"options": {
38+
"raw": {
39+
"language": "json"
40+
}
41+
}
42+
},
43+
"url": {
44+
"raw": "{{URL}}/challenges",
45+
"host": [
46+
"{{URL}}"
47+
],
48+
"path": [
49+
"challenges"
50+
]
51+
},
52+
"description": "The legacy processor should ingore the event if the `challenge.status` is `New`"
53+
},
54+
"response": []
55+
},
56+
{
57+
"name": "Create a draft challenge with full info",
58+
"event": [
59+
{
60+
"listen": "test",
61+
"script": {
62+
"id": "e0c5bbf6-2f1a-434d-b470-7d491056156e",
63+
"exec": [
64+
"var jsonData = pm.response.json();",
65+
"pm.environment.set(\"CHALLENGE_ID\", jsonData.id);",
66+
""
67+
],
68+
"type": "text/javascript"
69+
}
70+
}
71+
],
72+
"request": {
73+
"method": "POST",
74+
"header": [
75+
{
76+
"key": "Authorization",
77+
"type": "text",
78+
"value": "Bearer {{TOKEN}}"
79+
}
80+
],
81+
"body": {
82+
"mode": "raw",
83+
"raw": "{\n \"typeId\": \"e885273d-aeda-42c0-917d-bfbf979afbba\",\n \"name\": \"Thomas test challenge 11 June\",\n \"projectId\": 16531,\n \"status\": \"Draft\",\n \"terms\": [],\n \"description\": \"This is the description\",\n \"legacy\": {\n \"track\": \"DEVELOP\",\n \"reviewType\": \"COMMUNITY\"\n },\n \"timelineTemplateId\": \"7ebf1c69-f62f-4d3a-bdfb-fe9ddb56861c\",\n \"phases\": [\n {\n \"phaseId\": \"a93544bc-c165-4af4-b55e-18f3593b457a\",\n \"duration\": 172800\n },\n {\n \"phaseId\": \"6950164f-3c5e-4bdc-abc8-22aaf5a1bd49\",\n \"duration\": 432000\n },\n {\n \"phaseId\": \"aa5a3f78-79e0-4bf7-93ff-b11e8f5b398b\",\n \"duration\": 172800\n },\n {\n \"phaseId\": \"1c24cfb3-5b0a-4dbd-b6bd-4b0dff5349c6\",\n \"duration\": 43200\n },\n {\n \"phaseId\": \"797a6af7-cd3f-4436-9fca-9679f773bee9\",\n \"duration\": 57600\n }\n ],\n \"startDate\": \"2020-06-09T14:00:00.000Z\",\n \"prizeSets\": [\n {\n \"type\": \"placement\",\n \"description\": \"Challenge Prizes\",\n \"prizes\": [\n {\n \"value\": 500,\n \"type\": \"USD\"\n },\n {\n \"value\": 250,\n \"type\": \"USD\"\n }\n ]\n }\n ],\n \"tags\": [\n \"JavaScript\",\n \"Apex\",\n \"Visualforce\",\n \"Force.com\",\n \"Salesforce.com\"\n ]\n}",
84+
"options": {
85+
"raw": {
86+
"language": "json"
87+
}
88+
}
89+
},
90+
"url": {
91+
"raw": "{{URL}}/challenges",
92+
"host": [
93+
"{{URL}}"
94+
],
95+
"path": [
96+
"challenges"
97+
]
98+
},
99+
"description": "The legacy processor should create the challenge on legacy"
100+
},
101+
"response": []
102+
},
103+
{
104+
"name": "Update challenge to include full info",
105+
"request": {
106+
"method": "PATCH",
107+
"header": [
108+
{
109+
"key": "Authorization",
110+
"type": "text",
111+
"value": "Bearer {{TOKEN}}"
112+
}
113+
],
114+
"body": {
115+
"mode": "raw",
116+
"raw": "{\n \"typeId\": \"e885273d-aeda-42c0-917d-bfbf979afbba\",\n \"name\": \"Thomas test challenge 9 June\",\n \"projectId\": 16531,\n \"status\": \"New\",\n \"terms\": [],\n \"description\": \"This is the description\",\n \"legacy\": {\n \"track\": \"DEVELOP\",\n \"reviewType\": \"COMMUNITY\"\n },\n \"timelineTemplateId\": \"7ebf1c69-f62f-4d3a-bdfb-fe9ddb56861c\",\n \"phases\": [\n {\n \"phaseId\": \"a93544bc-c165-4af4-b55e-18f3593b457a\",\n \"duration\": 172800\n },\n {\n \"phaseId\": \"6950164f-3c5e-4bdc-abc8-22aaf5a1bd49\",\n \"duration\": 432000\n },\n {\n \"phaseId\": \"aa5a3f78-79e0-4bf7-93ff-b11e8f5b398b\",\n \"duration\": 172800\n },\n {\n \"phaseId\": \"1c24cfb3-5b0a-4dbd-b6bd-4b0dff5349c6\",\n \"duration\": 43200\n },\n {\n \"phaseId\": \"797a6af7-cd3f-4436-9fca-9679f773bee9\",\n \"duration\": 57600\n }\n ],\n \"startDate\": \"2020-06-09T14:00:00.000Z\",\n \"prizeSets\": [\n {\n \"type\": \"placement\",\n \"description\": \"Challenge Prizes\",\n \"prizes\": [\n {\n \"value\": 500,\n \"type\": \"USD\"\n },\n {\n \"value\": 250,\n \"type\": \"USD\"\n }\n ]\n }\n ],\n \"tags\": [\n \"JavaScript\",\n \"Apex\",\n \"Visualforce\",\n \"Force.com\",\n \"Salesforce.com\"\n ]\n}",
117+
"options": {
118+
"raw": {
119+
"language": "json"
120+
}
121+
}
122+
},
123+
"url": {
124+
"raw": "{{URL}}/challenges/{{CHALLENGE_ID}}",
125+
"host": [
126+
"{{URL}}"
127+
],
128+
"path": [
129+
"challenges",
130+
"{{CHALLENGE_ID}}"
131+
]
132+
},
133+
"description": "The legacy processor should ingore the event if the `challenge.status` is `New`"
134+
},
135+
"response": []
136+
},
137+
{
138+
"name": "Get challenge",
139+
"request": {
140+
"method": "GET",
141+
"header": [
142+
{
143+
"key": "Authorization",
144+
"type": "text",
145+
"value": "Bearer {{TOKEN}}"
146+
}
147+
],
148+
"url": {
149+
"raw": "{{URL}}/challenges/{{CHALLENGE_ID}}",
150+
"host": [
151+
"{{URL}}"
152+
],
153+
"path": [
154+
"challenges",
155+
"{{CHALLENGE_ID}}"
156+
]
157+
}
158+
},
159+
"response": []
160+
},
161+
{
162+
"name": "Update challenge status to Draft",
163+
"request": {
164+
"method": "PATCH",
165+
"header": [
166+
{
167+
"key": "Authorization",
168+
"type": "text",
169+
"value": "Bearer {{TOKEN}}"
170+
}
171+
],
172+
"body": {
173+
"mode": "raw",
174+
"raw": "{\n \"status\": \"Draft\"\n}",
175+
"options": {
176+
"raw": {
177+
"language": "json"
178+
}
179+
}
180+
},
181+
"url": {
182+
"raw": "{{URL}}/challenges/{{CHALLENGE_ID}}",
183+
"host": [
184+
"{{URL}}"
185+
],
186+
"path": [
187+
"challenges",
188+
"{{CHALLENGE_ID}}"
189+
]
190+
},
191+
"description": "The legacy processor should create the challenge on legacy"
192+
},
193+
"response": []
194+
},
195+
{
196+
"name": "Update challenge status to Active",
197+
"request": {
198+
"method": "PATCH",
199+
"header": [
200+
{
201+
"key": "Authorization",
202+
"type": "text",
203+
"value": "Bearer {{TOKEN}}"
204+
}
205+
],
206+
"body": {
207+
"mode": "raw",
208+
"raw": "{\n \"status\": \"Active\"\n}",
209+
"options": {
210+
"raw": {
211+
"language": "json"
212+
}
213+
}
214+
},
215+
"url": {
216+
"raw": "{{URL}}/challenges/{{CHALLENGE_ID}}",
217+
"host": [
218+
"{{URL}}"
219+
],
220+
"path": [
221+
"challenges",
222+
"{{CHALLENGE_ID}}"
223+
]
224+
},
225+
"description": "If the `challenge.legacy.directProjectId` is not set, meaning the challenge wasn't yet created on the legacy system, this will fail. Otherwise, the processor will activate the challenge on the legacy system."
226+
},
227+
"response": []
228+
},
229+
{
230+
"name": "Update challenge status to Completed and set winner",
231+
"request": {
232+
"method": "PATCH",
233+
"header": [
234+
{
235+
"key": "Authorization",
236+
"type": "text",
237+
"value": "Bearer {{TOKEN}}"
238+
}
239+
],
240+
"body": {
241+
"mode": "raw",
242+
"raw": "{\n \"status\": \"Completed\",\n \"winners\": [\n {\n \"userId\": 8547899,\n \"handle\": \"TonyJ\",\n \"placement\": 1\n }\n ]\n}",
243+
"options": {
244+
"raw": {
245+
"language": "json"
246+
}
247+
}
248+
},
249+
"url": {
250+
"raw": "{{URL}}/challenges/{{CHALLENGE_ID}}",
251+
"host": [
252+
"{{URL}}"
253+
],
254+
"path": [
255+
"challenges",
256+
"{{CHALLENGE_ID}}"
257+
]
258+
},
259+
"description": "The legacy processor should close the challenge on the backend"
260+
},
261+
"response": []
262+
}
263+
],
264+
"protocolProfileBehavior": {}
265+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"id": "00ccdcc5-b0b1-489e-aa4e-a8b5e6cb1360",
3+
"name": "Challenge V5 Test",
4+
"values": [
5+
{
6+
"key": "TOKEN",
7+
"value": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik5VSkZORGd4UlRVME5EWTBOVVkzTlRkR05qTXlRamxETmpOQk5UYzVRVUV3UlRFeU56TTJRUSJ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yl2eR7uAm8ze2tNEQs5OH7JD5RqDDg0-rxx1EBr3NQxj54iosY6T3J5e9rXs6thuew923TFA8Rz547771U3zBdsC1TjWvxrLvj7sDFXm0yUWhq-dsMea_PSZhbEAla6WRDVTYNKuni02uGTgEK-ram7jagUeu3PcXJmna19k73s6B2i-3eDpBMyX4MVCEzwQLXjsZKQYbdMCZcFlSD6_lkQHPMqJa0bJVYQANX8oJ47Aau4E88fCW2jvcTT8Qz_86INde8pLfmHxDhXzeiFoH3kPjyf7PxYMeFajpzlaXb6MQSsTsNmDZCgy-Obn7EOG-j-d82JjnYWg",
8+
"enabled": true
9+
},
10+
{
11+
"key": "URL",
12+
"value": "https://api.topcoder-dev.com/v5",
13+
"enabled": true
14+
},
15+
{
16+
"key": "CHALLENGE_ID",
17+
"value": "",
18+
"enabled": true
19+
}
20+
],
21+
"_postman_variable_scope": "environment",
22+
"_postman_exported_at": "2020-06-11T18:43:49.451Z",
23+
"_postman_exported_using": "Postman/7.26.0"
24+
}

0 commit comments

Comments
 (0)