-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathQuizLab_postman.json
More file actions
271 lines (271 loc) · 13.1 KB
/
QuizLab_postman.json
File metadata and controls
271 lines (271 loc) · 13.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
{
"info": {
"_postman_id": "quizlab-v21-fixed-validation",
"name": "QuizLab V21 Fixed Validation Suite",
"description": "Includes FIXES for 'Answer Question' payload (answer_content) and verified Dashboard routes.\n\nNarrative:\n1. Admin Bootstraps.\n2. HR builds Dept, Term, Users, Class (Dynamic).\n3. Teacher content lifecycle (Fixed Question Payload).\n4. Student exam lifecycle (Fixed Answer Payload).\n5. Tracking & Credits.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "0. Admin Persona",
"item": [
{
"name": "1. Admin Self-Registration",
"event": [{ "listen": "test", "script": { "exec": ["var jsonData = pm.response.json();", "if(jsonData.access_token) {", " pm.collectionVariables.set(\"admin_token\", jsonData.access_token);", "}"], "type": "text/javascript" } }],
"request": {
"auth": { "type": "noauth" },
"method": "POST",
"header": [ { "key": "Accept", "value": "application/json" } ],
"body": { "mode": "raw", "raw": "{\n \"name\": \"System Admin\",\n \"email\": \"admin@school.com\",\n \"password\": \"password\",\n \"role\": \"admin\",\n \"gender\": \"other\"\n}", "options": { "raw": { "language": "json" } } },
"url": "{{base_url}}/auth/register"
}
},
{
"name": "2. Creates HR Manager",
"event": [{ "listen": "test", "script": { "exec": ["var jsonData = pm.response.json();", "pm.collectionVariables.set(\"hr_id\", jsonData.data.id);"], "type": "text/javascript" } }],
"request": {
"method": "POST",
"header": [ { "key": "Accept", "value": "application/json" } ],
"body": { "mode": "raw", "raw": "{\n \"name\": \"HR Manager\",\n \"email\": \"hr@school.com\",\n \"password\": \"password\",\n \"role\": \"hr\",\n \"gender\": \"female\"\n}", "options": { "raw": { "language": "json" } } },
"url": "{{base_url}}/users"
}
}
],
"auth": {
"type": "bearer",
"bearer": [ { "key": "token", "value": "{{admin_token}}", "type": "string" } ]
}
},
{
"name": "1. HR Persona",
"item": [
{
"name": "1. Login HR",
"event": [{ "listen": "test", "script": { "exec": ["var jsonData = pm.response.json();", "pm.collectionVariables.set(\"hr_token\", jsonData.access_token);"], "type": "text/javascript" } }],
"request": {
"auth": { "type": "noauth" },
"method": "POST",
"header": [ { "key": "Accept", "value": "application/json" } ],
"body": { "mode": "raw", "raw": "{\n \"email\": \"hr@school.com\",\n \"password\": \"password\"\n}", "options": { "raw": { "language": "json" } } },
"url": "{{base_url}}/auth/login"
}
},
{
"name": "2. Create Academic Term",
"event": [{ "listen": "test", "script": { "exec": ["var jsonData = pm.response.json();", "pm.collectionVariables.set(\"term_id\", jsonData.data.id);"], "type": "text/javascript" } }],
"request": {
"method": "POST",
"header": [ { "key": "Accept", "value": "application/json" } ],
"body": { "mode": "raw", "raw": "{\n \"name\": \"Spring 2026\",\n \"start_date\": \"2026-01-01\",\n \"end_date\": \"2026-05-31\",\n \"is_current\": true\n}", "options": { "raw": { "language": "json" } } },
"url": "{{base_url}}/academic-terms"
}
},
{
"name": "3. Create Dept",
"event": [{ "listen": "test", "script": { "exec": ["var jsonData = pm.response.json();", "pm.collectionVariables.set(\"dept_id\", jsonData.data.id);"], "type": "text/javascript" } }],
"request": {
"method": "POST",
"header": [ { "key": "Accept", "value": "application/json" } ],
"body": { "mode": "raw", "raw": "{\n \"name\": \"Math Dept\",\n \"code\": \"MAT\"\n}", "options": { "raw": { "language": "json" } } },
"url": "{{base_url}}/departments"
}
},
{
"name": "4. Hire Teacher A",
"event": [{ "listen": "test", "script": { "exec": ["var jsonData = pm.response.json();", "pm.collectionVariables.set(\"teacher_id\", jsonData.data.id);"], "type": "text/javascript" } }],
"request": {
"method": "POST",
"header": [ { "key": "Accept", "value": "application/json" } ],
"body": { "mode": "raw", "raw": "{\n \"name\": \"Math Teacher\",\n \"email\": \"math@school.com\",\n \"password\": \"password\",\n \"role\": \"teacher\",\n \"gender\": \"male\"\n}", "options": { "raw": { "language": "json" } } },
"url": "{{base_url}}/users"
}
},
{
"name": "5. Admit Student 1",
"event": [{ "listen": "test", "script": { "exec": ["var jsonData = pm.response.json();", "pm.collectionVariables.set(\"student1_id\", jsonData.data.id);"], "type": "text/javascript" } }],
"request": {
"method": "POST",
"header": [ { "key": "Accept", "value": "application/json" } ],
"body": { "mode": "raw", "raw": "{\n \"name\": \"Student One\",\n \"email\": \"s1@school.com\",\n \"password\": \"password\",\n \"role\": \"student\",\n \"gender\": \"female\"\n}", "options": { "raw": { "language": "json" } } },
"url": "{{base_url}}/users"
}
},
{
"name": "6. Admit Student 2",
"event": [{ "listen": "test", "script": { "exec": ["var jsonData = pm.response.json();", "pm.collectionVariables.set(\"student2_id\", jsonData.data.id);"], "type": "text/javascript" } }],
"request": {
"method": "POST",
"header": [ { "key": "Accept", "value": "application/json" } ],
"body": { "mode": "raw", "raw": "{\n \"name\": \"Student Two\",\n \"email\": \"s2@school.com\",\n \"password\": \"password\",\n \"role\": \"student\",\n \"gender\": \"male\"\n}", "options": { "raw": { "language": "json" } } },
"url": "{{base_url}}/users"
}
},
{
"name": "7. Create Class",
"event": [{ "listen": "test", "script": { "exec": ["var jsonData = pm.response.json();", "pm.collectionVariables.set(\"class_id\", jsonData.data.id);"], "type": "text/javascript" } }],
"request": {
"method": "POST",
"header": [ { "key": "Accept", "value": "application/json" } ],
"body": { "mode": "raw", "raw": "{\n \"name\": \"Calculus 1\",\n \"department_id\": {{dept_id}},\n \"term_id\": {{term_id}},\n \"teacher_id\": {{teacher_id}},\n \"enrollment_code\": \"CALC1\"\n}", "options": { "raw": { "language": "json" } } },
"url": "{{base_url}}/classes"
}
},
{
"name": "8. Bulk Enroll",
"request": {
"method": "POST",
"header": [ { "key": "Accept", "value": "application/json" } ],
"body": { "mode": "raw", "raw": "{\n \"emails\": [\"s1@school.com\", \"s2@school.com\"]\n}", "options": { "raw": { "language": "json" } } },
"url": "{{base_url}}/classes/{{class_id}}/enroll-bulk"
}
}
],
"auth": {
"type": "bearer",
"bearer": [ { "key": "token", "value": "{{hr_token}}", "type": "string" } ]
}
},
{
"name": "2. Teacher Persona",
"item": [
{
"name": "1. Login Teacher",
"event": [{ "listen": "test", "script": { "exec": ["var jsonData = pm.response.json();", "pm.collectionVariables.set(\"teacher_token\", jsonData.access_token);"], "type": "text/javascript" } }],
"request": {
"auth": { "type": "noauth" },
"method": "POST",
"header": [ { "key": "Accept", "value": "application/json" } ],
"body": { "mode": "raw", "raw": "{\n \"email\": \"math@school.com\",\n \"password\": \"password\"\n}", "options": { "raw": { "language": "json" } } },
"url": "{{base_url}}/auth/login"
}
},
{
"name": "2. Create Quiz (Draft)",
"event": [{ "listen": "test", "script": { "exec": ["var jsonData = pm.response.json();", "pm.collectionVariables.set(\"quiz_id\", jsonData.data.id);"], "type": "text/javascript" } }],
"request": {
"method": "POST",
"header": [ { "key": "Accept", "value": "application/json" } ],
"body": { "mode": "raw", "raw": "{\n \"class_id\": {{class_id}},\n \"title\": \"Calculus Alpha\",\n \"type\": \"quiz\",\n \"time_limit_minutes\": 30\n}", "options": { "raw": { "language": "json" } } },
"url": "{{base_url}}/quizzes"
}
},
{
"name": "3. Edit Quiz",
"request": {
"method": "PUT",
"header": [ { "key": "Accept", "value": "application/json" } ],
"body": { "mode": "raw", "raw": "{\n \"type\": \"exam\",\n \"title\": \"Calculus Midterm\",\n \"time_limit_minutes\": 60,\n \"passing_score\": 50\n}", "options": { "raw": { "language": "json" } } },
"url": "{{base_url}}/quizzes/{{quiz_id}}"
}
},
{
"name": "4. Add Question",
"event": [{ "listen": "test", "script": { "exec": ["var jsonData = pm.response.json();", "var opts = jsonData.data.options; if(opts && opts.length > 0) { pm.collectionVariables.set(\"q1_opt_id_correct\", opts[0].id); }"], "type": "text/javascript" } }],
"request": {
"method": "POST",
"header": [ { "key": "Accept", "value": "application/json" } ],
"body": { "mode": "raw", "raw": "{\n \"type\": \"mcq\",\n \"points\": 100,\n \"content\": {\n \"text\": \"Derivative of x^2?\",\n \"options\": [\n {\"text\": \"2x\", \"is_correct\": true},\n {\"text\": \"x\", \"is_correct\": false}\n ]\n }\n}", "options": { "raw": { "language": "json" } } },
"url": "{{base_url}}/quizzes/{{quiz_id}}/questions"
}
},
{
"name": "5. Publish Quiz",
"request": {
"method": "PATCH",
"header": [ { "key": "Accept", "value": "application/json" } ],
"url": "{{base_url}}/quizzes/{{quiz_id}}/publish"
}
}
],
"auth": {
"type": "bearer",
"bearer": [ { "key": "token", "value": "{{teacher_token}}", "type": "string" } ]
}
},
{
"name": "3. Student Persona",
"item": [
{
"name": "1. Login Student 1",
"event": [{ "listen": "test", "script": { "exec": ["var jsonData = pm.response.json();", "pm.collectionVariables.set(\"student_token\", jsonData.access_token);"], "type": "text/javascript" } }],
"request": {
"auth": { "type": "noauth" },
"method": "POST",
"header": [ { "key": "Accept", "value": "application/json" } ],
"body": { "mode": "raw", "raw": "{\n \"email\": \"s1@school.com\",\n \"password\": \"password\"\n}", "options": { "raw": { "language": "json" } } },
"url": "{{base_url}}/auth/login"
}
},
{
"name": "2. Take Exam",
"event": [{ "listen": "test", "script": { "exec": ["var jsonData = pm.response.json();", "var qs = jsonData.data.quiz.questions; if(qs && qs.length > 0) { pm.collectionVariables.set(\"q1_id\", qs[0].id); }", "pm.collectionVariables.set(\"attempt_id\", jsonData.data.id);"], "type": "text/javascript" } }],
"request": {
"method": "POST",
"header": [ { "key": "Accept", "value": "application/json" } ],
"url": "{{base_url}}/quizzes/{{quiz_id}}/attempts"
}
},
{
"name": "3. Answer Question (Fixed Payload)",
"request": {
"method": "POST",
"header": [ { "key": "Accept", "value": "application/json" } ],
"body": { "mode": "raw", "raw": "{\n \"question_id\": {{q1_id}},\n \"answer_content\": { \"option_id\": {{q1_opt_id_correct}} }\n}", "options": { "raw": { "language": "json" } } },
"url": "{{base_url}}/attempts/{{attempt_id}}/answers"
}
},
{
"name": "4. Submit Exam",
"request": {
"method": "POST",
"header": [ { "key": "Accept", "value": "application/json" } ],
"url": "{{base_url}}/attempts/{{attempt_id}}/submit"
}
},
{
"name": "5. Check My Credits",
"request": {
"method": "GET",
"header": [ { "key": "Accept", "value": "application/json" } ],
"url": "{{base_url}}/dashboard/student/credits"
}
}
],
"auth": {
"type": "bearer",
"bearer": [ { "key": "token", "value": "{{student_token}}", "type": "string" } ]
}
},
{
"name": "4. Performance Review",
"item": [
{
"name": "1. Teacher Checks Class Performance",
"request": {
"method": "GET",
"header": [ { "key": "Authorization", "value": "Bearer {{teacher_token}}" }, { "key": "Accept", "value": "application/json" } ],
"url": "{{base_url}}/dashboard/class/{{class_id}}/performance"
}
}
]
}
],
"variable": [
{ "key": "base_url", "value": "http://127.0.0.1:8000/api/v1", "type": "string" },
{ "key": "admin_token", "value": "", "type": "string" },
{ "key": "hr_token", "value": "", "type": "string" },
{ "key": "teacher_token", "value": "", "type": "string" },
{ "key": "student_token", "value": "", "type": "string" },
{ "key": "hr_id", "value": "", "type": "string" },
{ "key": "teacher_id", "value": "", "type": "string" },
{ "key": "student1_id", "value": "", "type": "string" },
{ "key": "student2_id", "value": "", "type": "string" },
{ "key": "dept_id", "value": "", "type": "string" },
{ "key": "term_id", "value": "", "type": "string" },
{ "key": "class_id", "value": "", "type": "string" },
{ "key": "quiz_id", "value": "", "type": "string" },
{ "key": "q1_id", "value": "", "type": "string" },
{ "key": "q1_opt_id_correct", "value": "", "type": "string" },
{ "key": "attempt_id", "value": "", "type": "string" }
]
}