Skip to content

Add postman collection to test the legacy processor #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
{
"info": {
"_postman_id": "4ce83573-7d66-4f37-a968-52c1f4bfdc5d",
"name": "Challenge V5 Test processor",
"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`",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Create a new challenge with only basic info",
"event": [
{
"listen": "test",
"script": {
"id": "b67c86f1-6a2d-42cb-a4da-ab69a63f9f67",
"exec": [
"var jsonData = pm.response.json();",
"pm.environment.set(\"CHALLENGE_ID\", jsonData.id);",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"type": "text",
"value": "Bearer {{TOKEN}}"
}
],
"body": {
"mode": "raw",
"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}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/challenges",
"host": [
"{{URL}}"
],
"path": [
"challenges"
]
},
"description": "The legacy processor should ingore the event if the `challenge.status` is `New`"
},
"response": []
},
{
"name": "Create a draft challenge with full info",
"event": [
{
"listen": "test",
"script": {
"id": "e0c5bbf6-2f1a-434d-b470-7d491056156e",
"exec": [
"var jsonData = pm.response.json();",
"pm.environment.set(\"CHALLENGE_ID\", jsonData.id);",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"type": "text",
"value": "Bearer {{TOKEN}}"
}
],
"body": {
"mode": "raw",
"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}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/challenges",
"host": [
"{{URL}}"
],
"path": [
"challenges"
]
},
"description": "The legacy processor should create the challenge on legacy"
},
"response": []
},
{
"name": "Update challenge to include full info",
"request": {
"method": "PATCH",
"header": [
{
"key": "Authorization",
"type": "text",
"value": "Bearer {{TOKEN}}"
}
],
"body": {
"mode": "raw",
"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}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/challenges/{{CHALLENGE_ID}}",
"host": [
"{{URL}}"
],
"path": [
"challenges",
"{{CHALLENGE_ID}}"
]
},
"description": "The legacy processor should ingore the event if the `challenge.status` is `New`"
},
"response": []
},
{
"name": "Get challenge",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"type": "text",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{URL}}/challenges/{{CHALLENGE_ID}}",
"host": [
"{{URL}}"
],
"path": [
"challenges",
"{{CHALLENGE_ID}}"
]
}
},
"response": []
},
{
"name": "Update challenge status to Draft",
"request": {
"method": "PATCH",
"header": [
{
"key": "Authorization",
"type": "text",
"value": "Bearer {{TOKEN}}"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"status\": \"Draft\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/challenges/{{CHALLENGE_ID}}",
"host": [
"{{URL}}"
],
"path": [
"challenges",
"{{CHALLENGE_ID}}"
]
},
"description": "The legacy processor should create the challenge on legacy"
},
"response": []
},
{
"name": "Update challenge status to Active",
"request": {
"method": "PATCH",
"header": [
{
"key": "Authorization",
"type": "text",
"value": "Bearer {{TOKEN}}"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"status\": \"Active\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/challenges/{{CHALLENGE_ID}}",
"host": [
"{{URL}}"
],
"path": [
"challenges",
"{{CHALLENGE_ID}}"
]
},
"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."
},
"response": []
},
{
"name": "Update challenge status to Completed and set winner",
"request": {
"method": "PATCH",
"header": [
{
"key": "Authorization",
"type": "text",
"value": "Bearer {{TOKEN}}"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"status\": \"Completed\",\n \"winners\": [\n {\n \"userId\": 8547899,\n \"handle\": \"TonyJ\",\n \"placement\": 1\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/challenges/{{CHALLENGE_ID}}",
"host": [
"{{URL}}"
],
"path": [
"challenges",
"{{CHALLENGE_ID}}"
]
},
"description": "The legacy processor should close the challenge on the backend"
},
"response": []
}
],
"protocolProfileBehavior": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"id": "00ccdcc5-b0b1-489e-aa4e-a8b5e6cb1360",
"name": "Challenge V5 Test",
"values": [
{
"key": "TOKEN",
"value": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik5VSkZORGd4UlRVME5EWTBOVVkzTlRkR05qTXlRamxETmpOQk5UYzVRVUV3UlRFeU56TTJRUSJ9.eyJpc3MiOiJodHRwczovL3RvcGNvZGVyLWRldi5hdXRoMC5jb20vIiwic3ViIjoiakdJZjJwZDNmNDRCMWpxdk9haTMwQklLVFphbllCZlVAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbTJtLnRvcGNvZGVyLWRldi5jb20vIiwiaWF0IjoxNTkxODY0NTU0LCJleHAiOjE1OTE5NTA5NTQsImF6cCI6ImpHSWYycGQzZjQ0QjFqcXZPYWkzMEJJS1RaYW5ZQmZVIiwic2NvcGUiOiJ1cGRhdGU6dXNlcl9wcm9maWxlcyBhbGw6d3JpdGU6dXNlcl9wcm9maWxlcyB3cml0ZTp1c2VyX3Byb2ZpbGVzIGNyZWF0ZTpjb25uZWN0X3Byb2plY3QgYWxsOmNoYWxsZW5nZXMgcmVhZDpjaGFsbGVuZ2VzIHdyaXRlOmNoYWxsZW5nZXMgYWxsOmdyb3VwcyB3cml0ZTpncm91cHMgcmVhZDpncm91cHMgdXBkYXRlOnN1Ym1pc3Npb24gcmVhZDpzdWJtaXNzaW9uIGRlbGV0ZTpzdWJtaXNzaW9uIGNyZWF0ZTpzdWJtaXNzaW9uIGFsbDpzdWJtaXNzaW9uIHJlYWQ6cHJvamVjdCBhbGw6Y29ubmVjdF9wcm9qZWN0IHJlYWQ6YnVzX3RvcGljcyB3cml0ZTpidXNfYXBpIHJlYWQ6ZW1haWxfdGVtcGxhdGVzIHJlYWQ6dXNlcl9wcm9maWxlcyByZWFkOnJvbGVzIHJlYWQ6cHJvamVjdC11c2VyIHJlYWQ6cHJvamVjdC1wZXJtaXNzaW9uIHJlYWQ6cmVzb3VyY2VzIHdyaXRlOnJlc291cmNlcyBkZWxldGU6cmVzb3VyY2VzIHVwZGF0ZTpyZXNvdXJjZXMgYWxsOnJlc291cmNlcyByZWFkOnRlcm1zIGFsbDp0ZXJtcyBhbGw6cHJvamVjdHMgcmVhZDpwcm9qZWN0cyIsImd0eSI6ImNsaWVudC1jcmVkZW50aWFscyJ9.WdKoMHL805Yl2eR7uAm8ze2tNEQs5OH7JD5RqDDg0-rxx1EBr3NQxj54iosY6T3J5e9rXs6thuew923TFA8Rz547771U3zBdsC1TjWvxrLvj7sDFXm0yUWhq-dsMea_PSZhbEAla6WRDVTYNKuni02uGTgEK-ram7jagUeu3PcXJmna19k73s6B2i-3eDpBMyX4MVCEzwQLXjsZKQYbdMCZcFlSD6_lkQHPMqJa0bJVYQANX8oJ47Aau4E88fCW2jvcTT8Qz_86INde8pLfmHxDhXzeiFoH3kPjyf7PxYMeFajpzlaXb6MQSsTsNmDZCgy-Obn7EOG-j-d82JjnYWg",
"enabled": true
},
{
"key": "URL",
"value": "https://api.topcoder-dev.com/v5",
"enabled": true
},
{
"key": "CHALLENGE_ID",
"value": "",
"enabled": true
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2020-06-11T18:43:49.451Z",
"_postman_exported_using": "Postman/7.26.0"
}