-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPI_testing_project.postman_collection.json
More file actions
1113 lines (1057 loc) · 59.8 KB
/
API_testing_project.postman_collection.json
File metadata and controls
1113 lines (1057 loc) · 59.8 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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"info": {
"_postman_id": "sv-students",
"name": "API Test Suite",
"description": "# SV Students Recommend | API Test Suite v3\n\nבנוי לפי ה-OpenAPI spec האמיתי מ-/openapi.json.\n\n**סדר הרצה:** Team 1 → Team 4 (כדי לקבל admin_token) → Team 2 → Team 3 → Team 5 → Teardown\n\n## משתני סביבה נדרשים (מראש)\n| Key | Example Value |\n|---|---|\n| `BaseURL` | `https://sv-students-recommend.onrender.com` |\n| `name` | `Test Student` |\n| `email` | `testuser@sv-test.dev` |\n| `password` | `TestPass1234!` |\n| `adminuser` | `hagai@svcollege.co.il` |\n| `adminpass` | `test1234` |\n\n## משתנים שנשמרים אוטומטית\n`user_id`, `testuser_token`, `admin_token`, `rec_id`, `comment_id`, `blacklist_id`",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Team 1 | Auth & Profile",
"description": "POST /auth/register · POST /auth/login · POST /auth/recover · GET /api/profile/me · DELETE /api/profile/me · PUT /api/profile/password · GET /api/profile/token",
"item": [
{
"name": "✅ Register New User",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"// Schema per OpenAPI: UserOut → {id, name, email, access_token}",
"const res = pm.response.json();",
"if (res.id) { pm.environment.set('user_id', res.id); console.log('✅ user_id:', res.id); }",
"",
"pm.test('201 Created', () => { pm.response.to.have.status(201); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Body matches UserOut schema: id, name, email, access_token', () => {",
" pm.expect(res).to.have.all.keys('id','name','email','access_token');",
"});",
"pm.test('Returned email matches sent email', () => {",
" pm.expect(res.email).to.eql(pm.environment.get('email'));",
"});",
"pm.test('access_token is a non-empty string', () => {",
" pm.expect(res.access_token).to.be.a('string').and.not.empty;",
"});"
]}
}],
"request": {
"auth": { "type": "noauth" },
"method": "POST",
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": { "mode": "raw", "raw": "{\n \"name\": \"{{name}}\",\n \"email\": \"{{email}}\",\n \"password\": \"{{password}}\"\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/auth/register?skip_captcha=true", "host": ["{{BaseURL}}"], "path": ["auth","register"], "query": [{"key":"skip_captcha","value":"true"}] },
"description": "**Schema:** UserRegister → name (required), email (required, format:email), password (required, min 4 chars)\n**Response 201:** UserOut → id, name, email, access_token\n**Response 422:** Validation error"
},
"response": []
},
{
"name": "❌ Register | Duplicate Email (Negative)",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"pm.test('4xx | duplicate email is rejected', () => {",
" pm.expect(pm.response.code).to.be.within(400, 499);",
"});",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Error detail is present in body', () => {",
" const res = pm.response.json();",
" pm.expect(res.detail || res.message || res.error).to.exist;",
"});"
]}
}],
"request": {
"auth": { "type": "noauth" },
"method": "POST",
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": { "mode": "raw", "raw": "{\n \"name\": \"{{name}}\",\n \"email\": \"{{email}}\",\n \"password\": \"{{password}}\"\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/auth/register?skip_captcha=true", "host": ["{{BaseURL}}"], "path": ["auth","register"], "query": [{"key":"skip_captcha","value":"true"}] },
"description": "**Negative test:** שולח אותו email פעם שנייה. מצפה ל-4xx."
},
"response": []
},
{
"name": "❌ Register | Missing Required Field (Negative)",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"// name הוא required לפי schema | חסרונו צריך להחזיר 422",
"pm.test('422 Unprocessable | missing required field', () => {",
" pm.response.to.have.status(422);",
"});",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Validation error detail present', () => {",
" const res = pm.response.json();",
" pm.expect(res.detail).to.be.an('array').and.not.empty;",
"});"
]}
}],
"request": {
"auth": { "type": "noauth" },
"method": "POST",
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": { "mode": "raw", "raw": "{\n \"email\": \"{{email}}\",\n \"password\": \"{{password}}\"\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/auth/register?skip_captcha=true", "host": ["{{BaseURL}}"], "path": ["auth","register"], "query": [{"key":"skip_captcha","value":"true"}] },
"description": "**Negative test:** שולח בלי שדה name שהוא required. מצפה ל-422."
},
"response": []
},
{
"name": "✅ Login | Get User Token",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"// BUG NOTE: תיעוד אומר response 200 מחזיר UserOut",
"// אבל UserOut מכיל access_token | זה לא סטנדרטי ל-login response",
"// נבדוק את שניהם",
"const res = pm.response.json();",
"if (res.access_token) { pm.environment.set('testuser_token', res.access_token); console.log('✅ testuser_token saved'); }",
"",
"pm.test('200 OK', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('access_token present and non-empty', () => {",
" pm.expect(res.access_token).to.be.a('string').and.not.empty;",
"});",
"pm.test('Body contains id, name, email', () => {",
" pm.expect(res).to.include.all.keys('id','name','email');",
"});"
]}
}],
"request": {
"auth": { "type": "noauth" },
"method": "POST",
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": { "mode": "raw", "raw": "{\n \"email\": \"{{email}}\",\n \"password\": \"{{password}}\"\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/auth/login", "host": ["{{BaseURL}}"], "path": ["auth","login"] },
"description": "**Schema:** UserLogin → email, password\n**Response 200:** UserOut → id, name, email, access_token\n**Response 401:** Invalid email or password"
},
"response": []
},
{
"name": "❌ Login | Wrong Password (Negative)",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"pm.test('401 Unauthorized | wrong password', () => { pm.response.to.have.status(401); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('No access_token in error body', () => {",
" try {",
" const res = pm.response.json();",
" pm.expect(res).to.not.have.property('access_token');",
" } catch(e) { /* body may be empty on 401, that's fine */ }",
"});"
]}
}],
"request": {
"auth": { "type": "noauth" },
"method": "POST",
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": { "mode": "raw", "raw": "{\n \"email\": \"{{email}}\",\n \"password\": \"WRONG_PASSWORD_XYZ\"\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/auth/login", "host": ["{{BaseURL}}"], "path": ["auth","login"] },
"description": "**Negative test:** סיסמה שגויה. OpenAPI מתעד 401 במפורש."
},
"response": []
},
{
"name": "✅ Get My Profile",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"// BUG NOTE: OpenAPI מגדיר response schema כ-{} (ריק!) | אין schema רשמי",
"// מבדקים מה שאנחנו מצפים לקבל בפועל",
"const res = pm.response.json();",
"pm.test('200 OK', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Response is a non-empty object', () => {",
" pm.expect(typeof res).to.eql('object');",
" pm.expect(Object.keys(res).length).to.be.above(0);",
"});",
"pm.test('Profile email matches env email', () => {",
" pm.expect(res.email).to.eql(pm.environment.get('email'));",
"});"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{testuser_token}}", "type": "string" }] },
"method": "GET",
"header": [{ "key": "accept", "value": "application/json" }],
"url": { "raw": "{{BaseURL}}/api/profile/me", "host": ["{{BaseURL}}"], "path": ["api","profile","me"] },
"description": "**Response 200:** {} (schema לא מוגדר ב-OpenAPI | זה באג בתיעוד)\n**Auth:** Bearer token required"
},
"response": []
},
{
"name": "✅ Get Bearer Token",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"// BUG NOTE: גם כאן response schema הוא {} | לא מוגדר",
"const res = pm.response.json();",
"pm.test('200 OK', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Response is a non-empty object', () => {",
" pm.expect(typeof res).to.eql('object');",
" pm.expect(Object.keys(res).length).to.be.above(0);",
"});"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{testuser_token}}", "type": "string" }] },
"method": "GET",
"header": [{ "key": "accept", "value": "application/json" }],
"url": { "raw": "{{BaseURL}}/api/profile/token", "host": ["{{BaseURL}}"], "path": ["api","profile","token"] },
"description": "**Response 200:** {} (schema לא מוגדר)\n**Auth:** Bearer token required"
},
"response": []
},
{
"name": "✅ Password Reset | Request Email",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"pm.test('200 OK | reset email accepted', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });"
]}
}],
"request": {
"auth": { "type": "noauth" },
"method": "POST",
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": { "mode": "raw", "raw": "{\n \"email\": \"{{email}}\",\n \"redirect_to\": \"\"\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/auth/recover", "host": ["{{BaseURL}}"], "path": ["auth","recover"] },
"description": "**Schema:** PasswordResetRequest → email (required, format:email), redirect_to (default: '')\n**Response 200:** {} (empty schema)"
},
"response": []
},
{
"name": "✅ Change Password",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"// BUG NOTE: OpenAPI מגדיר response 204 No Content",
"// אבל הקולקשן המקורי בדק 2xx | 204 מחזיר גוף ריק לחלוטין",
"pm.test('204 No Content | password changed', () => { pm.response.to.have.status(204); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Response body is empty (204 = no body)', () => {",
" pm.expect(pm.response.text()).to.be.empty;",
"});"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{testuser_token}}", "type": "string" }] },
"method": "PUT",
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": { "mode": "raw", "raw": "{\n \"new_password\": \"{{password}}\"\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/api/profile/password", "host": ["{{BaseURL}}"], "path": ["api","profile","password"] },
"description": "**Schema:** PasswordChange → new_password (required, only field!)\n⚠️ **BUG FOUND:** הקולקשן המקורי שלח גם `email` בבקשה, אבל PasswordChange schema מכיל רק `new_password`.\n**Response 204:** No Content (גוף ריק)"
},
"response": []
},
{
"name": "✅ Login After Password Change",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"const res = pm.response.json();",
"if (res.access_token) { pm.environment.set('testuser_token', res.access_token); console.log('✅ Token refreshed'); }",
"pm.test('200 OK | new password works', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Fresh access_token returned', () => { pm.expect(res.access_token).to.be.a('string').and.not.empty; });"
]}
}],
"request": {
"auth": { "type": "noauth" },
"method": "POST",
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": { "mode": "raw", "raw": "{\n \"email\": \"{{email}}\",\n \"password\": \"{{password}}\"\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/auth/login", "host": ["{{BaseURL}}"], "path": ["auth","login"] },
"description": "מאמת שהסיסמה החדשה תקינה ומרענן testuser_token."
},
"response": []
}
]
},
{
"name": "Team 4 | Admin (Login First)",
"description": "מריצים את Team 4 לפני Team 2/3 כדי ש-admin_token יהיה זמין לבדיקות שליליות של צוות 3.",
"item": [
{
"name": "✅ Login | Get Admin Token",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"const res = pm.response.json();",
"if (res.access_token) { pm.environment.set('admin_token', res.access_token); console.log('✅ admin_token saved'); }",
"pm.test('200 OK | admin login', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('access_token present', () => { pm.expect(res.access_token).to.be.a('string').and.not.empty; });"
]}
}],
"request": {
"auth": { "type": "noauth" },
"method": "POST",
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": { "mode": "raw", "raw": "{\n \"email\": \"{{adminuser}}\",\n \"password\": \"{{adminpass}}\"\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/auth/login", "host": ["{{BaseURL}}"], "path": ["auth","login"] },
"description": "כניסת Admin. שומר admin_token לשאר תיקיית Admin ולבדיקות שליליות בצוות 3."
},
"response": []
},
{
"name": "✅ Get All Users",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"// BUG NOTE: response schema הוא {} | לא מוגדר. בודקים מה שמגיע בפועל",
"const res = pm.response.json();",
"pm.test('200 OK | user list returned', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Response is an array', () => { pm.expect(res).to.be.an('array'); });",
"pm.test('Each user has id and email', () => {",
" if (res.length > 0) { pm.expect(res[0]).to.include.all.keys('id','email'); }",
"});"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{admin_token}}", "type": "string" }] },
"method": "GET",
"header": [{ "key": "accept", "value": "application/json" }],
"url": { "raw": "{{BaseURL}}/api/admin/users", "host": ["{{BaseURL}}"], "path": ["api","admin","users"] },
"description": "**Response 200:** {} (schema לא מוגדר)\n**Auth:** Admin Bearer token"
},
"response": []
},
{
"name": "❌ Get All Users | Regular Token (Negative)",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"pm.test('401 or 403 | non-admin rejected', () => {",
" pm.expect([401,403]).to.include(pm.response.code);",
"});",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{testuser_token}}", "type": "string" }] },
"method": "GET",
"header": [{ "key": "accept", "value": "application/json" }],
"url": { "raw": "{{BaseURL}}/api/admin/users", "host": ["{{BaseURL}}"], "path": ["api","admin","users"] },
"description": "**Negative test:** גישת Admin עם token של משתמש רגיל."
},
"response": []
},
{
"name": "✅ Ban User",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"// BUG NOTE: response schema {} | לא מוגדר. מצפה ל-200",
"pm.test('200 OK | user banned', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{admin_token}}", "type": "string" }] },
"method": "POST",
"header": [{ "key": "accept", "value": "application/json" }],
"url": { "raw": "{{BaseURL}}/api/admin/users/{{user_id}}/ban", "host": ["{{BaseURL}}"], "path": ["api","admin","users","{{user_id}}","ban"] },
"description": "**Response 200:** {} (schema לא מוגדר)\nחייב להיות מלווה תמיד ב-Unban."
},
"response": []
},
{
"name": "✅ Unban User",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"pm.test('200 OK | user unbanned', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{admin_token}}", "type": "string" }] },
"method": "POST",
"header": [{ "key": "accept", "value": "application/json" }],
"url": { "raw": "{{BaseURL}}/api/admin/users/{{user_id}}/unban", "host": ["{{BaseURL}}"], "path": ["api","admin","users","{{user_id}}","unban"] },
"description": "מחזיר את המשתמש לפעולה תקינה."
},
"response": []
},
{
"name": "✅ Get Admin Settings",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"const res = pm.response.json();",
"pm.test('200 OK | settings returned', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Response is a non-empty object/array', () => {",
" pm.expect(typeof res).to.eql('object');",
"});"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{admin_token}}", "type": "string" }] },
"method": "GET",
"header": [{ "key": "accept", "value": "application/json" }],
"url": { "raw": "{{BaseURL}}/api/admin/settings", "host": ["{{BaseURL}}"], "path": ["api","admin","settings"] },
"description": "**Response 200:** {} (schema לא מוגדר)"
},
"response": []
},
{
"name": "✅ Turn Off Recommendations",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"// BUG NOTE: הקולקשן המקורי ציפה ל-2xx אבל OpenAPI מגדיר 200 (לא 204)",
"pm.test('200 OK | setting updated', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{admin_token}}", "type": "string" }] },
"method": "PUT",
"header": [{"key":"accept","value":"application/json"},{"key":"Content-Type","value":"application/json"}],
"body": { "mode": "raw", "raw": "{\n \"value\": \"false\"\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/api/admin/settings/recommendations_enabled", "host": ["{{BaseURL}}"], "path": ["api","admin","settings","recommendations_enabled"] },
"description": "**Schema:** Body_update_setting → value (required, string)\n**Response 200:** {} (schema לא מוגדר)"
},
"response": []
},
{
"name": "✅ Turn On Recommendations",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"pm.test('200 OK | recommendations re-enabled', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{admin_token}}", "type": "string" }] },
"method": "PUT",
"header": [{"key":"accept","value":"application/json"},{"key":"Content-Type","value":"application/json"}],
"body": { "mode": "raw", "raw": "{\n \"value\": \"true\"\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/api/admin/settings/recommendations_enabled", "host": ["{{BaseURL}}"], "path": ["api","admin","settings","recommendations_enabled"] },
"description": "מחזיר את ההגדרה לברירת המחדל. **חייב לרוץ תמיד אחרי Turn Off.**"
},
"response": []
}
]
},
{
"name": "Team 2 | Recommendations",
"description": "GET /api/recommendations · POST /api/recommendations · GET /api/recommendations/{rec_id} · PUT /api/recommendations/{rec_id} · DELETE /api/recommendations/{rec_id}",
"item": [
{
"name": "✅ Get All Recommendations",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"const res = pm.response.json();",
"pm.test('200 OK | list returned', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Response is an array', () => { pm.expect(res).to.be.an('array'); });",
"pm.test('Each item matches RecommendationOut schema', () => {",
" if (res.length > 0) {",
" pm.expect(res[0]).to.include.all.keys('id','name','category','description','image_url','website_link','recommender_name','created_by','created_at','updated_at');",
" }",
"});"
]}
}],
"request": {
"method": "GET",
"header": [{ "key": "accept", "value": "application/json" }],
"url": { "raw": "{{BaseURL}}/api/recommendations", "host": ["{{BaseURL}}"], "path": ["api","recommendations"] },
"description": "**Public endpoint | no auth required**\n**Query params:** category (optional), skip (default 0), limit (default 50, max 100)\n**Response 200:** Array of RecommendationOut"
},
"response": []
},
{
"name": "✅ Get All Recommendations | Filter by Category",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"const res = pm.response.json();",
"pm.test('200 OK', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('All returned items have category=Movie', () => {",
" res.forEach(item => pm.expect(item.category).to.eql('Movie'));",
"});"
]}
}],
"request": {
"method": "GET",
"header": [{ "key": "accept", "value": "application/json" }],
"url": { "raw": "{{BaseURL}}/api/recommendations?category=Movie", "host": ["{{BaseURL}}"], "path": ["api","recommendations"], "query": [{"key":"category","value":"Movie"}] },
"description": "בדיקת סינון לפי category. מאמת שכל התוצאות מתאימות לפילטר."
},
"response": []
},
{
"name": "✅ Create Recommendation",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"const res = pm.response.json();",
"if (res.id) { pm.environment.set('rec_id', res.id); console.log('✅ rec_id:', res.id); }",
"",
"pm.test('201 Created', () => { pm.response.to.have.status(201); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Body matches RecommendationOut schema', () => {",
" pm.expect(res).to.include.all.keys('id','name','category','description','image_url','website_link','recommender_name','created_by','created_at','updated_at');",
"});",
"pm.test('category default is Movie', () => { pm.expect(res.category).to.eql('Movie'); });",
"pm.test('comment_count defaults to 0', () => { pm.expect(res.comment_count).to.eql(0); });"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{testuser_token}}", "type": "string" }] },
"method": "POST",
"header": [{ "key": "accept", "value": "application/json" }],
"body": {
"mode": "formdata",
"formdata": [
{ "key": "name", "value": "Test Movie | API Suite", "type": "text" },
{ "key": "category", "value": "Movie", "type": "text" },
{ "key": "description", "value": "Created by automated API test suite", "type": "text" },
{ "key": "recommender_name", "value": "Team 2", "type": "text" },
{ "key": "website_link", "value": "https://example.com", "type": "text" }
]
},
"url": { "raw": "{{BaseURL}}/api/recommendations", "host": ["{{BaseURL}}"], "path": ["api","recommendations"] },
"description": "**Schema:** Body_create_recommendation → name (required), recommender_name (required), category (default: Movie), description, website_link, image\n**Auth:** Authorization header required\n**Response 201:** RecommendationOut"
},
"response": []
},
{
"name": "❌ Create Recommendation | No Token (Negative)",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"pm.test('422 or 401 | unauthenticated create rejected', () => {",
" pm.expect([401,422]).to.include(pm.response.code);",
"});",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });"
]}
}],
"request": {
"auth": { "type": "noauth" },
"method": "POST",
"header": [{ "key": "accept", "value": "application/json" }],
"body": {
"mode": "formdata",
"formdata": [
{ "key": "name", "value": "Unauthorized Rec", "type": "text" },
{ "key": "recommender_name", "value": "Nobody", "type": "text" }
]
},
"url": { "raw": "{{BaseURL}}/api/recommendations", "host": ["{{BaseURL}}"], "path": ["api","recommendations"] },
"description": "**Negative test:** Authorization header הוא required לפי schema. ציפיה: 422 (missing required header) או 401."
},
"response": []
},
{
"name": "✅ Get Recommendation by ID",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"const res = pm.response.json();",
"pm.test('200 OK', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Returned id matches rec_id env var', () => {",
" pm.expect(res.id).to.eql(pm.environment.get('rec_id'));",
"});",
"pm.test('Body matches RecommendationOut schema', () => {",
" pm.expect(res).to.include.all.keys('id','name','category','description','image_url','website_link','recommender_name','created_by','created_at','updated_at');",
"});"
]}
}],
"request": {
"method": "GET",
"header": [{ "key": "accept", "value": "application/json" }],
"url": { "raw": "{{BaseURL}}/api/recommendations/{{rec_id}}", "host": ["{{BaseURL}}"], "path": ["api","recommendations","{{rec_id}}"] },
"description": "**Public endpoint**\n**Response 200:** RecommendationOut"
},
"response": []
},
{
"name": "❌ Get Recommendation | Non-Existent ID (Negative)",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"pm.test('404 Not Found | non-existent rec_id', () => {",
" pm.response.to.have.status(404);",
"});",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });"
]}
}],
"request": {
"method": "GET",
"header": [{ "key": "accept", "value": "application/json" }],
"url": { "raw": "{{BaseURL}}/api/recommendations/00000000-0000-0000-0000-000000000000", "host": ["{{BaseURL}}"], "path": ["api","recommendations","00000000-0000-0000-0000-000000000000"] },
"description": "**Negative test:** UUID שלא קיים. מצפה ל-404.\n⚠️ **BUG TO INVESTIGATE:** OpenAPI לא מתעד 404 בכלל לנקודת קצה זו | רק 200 ו-422. אם השרת מחזיר 404 בפועל, זה בעיה בתיעוד."
},
"response": []
},
{
"name": "✅ Update Recommendation",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"const res = pm.response.json();",
"pm.test('200 OK | updated', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Category changed to Book', () => { pm.expect(res.category).to.eql('Book'); });",
"pm.test('Description updated', () => { pm.expect(res.description).to.eql('Updated by API test suite'); });",
"pm.test('Body matches RecommendationOut schema', () => {",
" pm.expect(res).to.include.all.keys('id','name','category','description','image_url','website_link','recommender_name','created_by','created_at','updated_at');",
"});"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{testuser_token}}", "type": "string" }] },
"method": "PUT",
"header": [{"key":"accept","value":"application/json"},{"key":"Content-Type","value":"application/json"}],
"body": { "mode": "raw", "raw": "{\n \"name\": \"Test Movie | Updated\",\n \"category\": \"Book\",\n \"description\": \"Updated by API test suite\",\n \"recommender_name\": \"Team 2 Updated\",\n \"website_link\": \"https://example.com/updated\"\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/api/recommendations/{{rec_id}}", "host": ["{{BaseURL}}"], "path": ["api","recommendations","{{rec_id}}"] },
"description": "**Schema:** RecommendationUpdate → name, category (enum: Book/Movie/Series/Activity/Other), description, recommender_name, website_link (כולם optional)\n**Auth:** Authorization header required\n**Response 200:** RecommendationOut"
},
"response": []
},
{
"name": "❌ Update Recommendation | Invalid Category (Negative)",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"// category enum: Book|Movie|Series|Activity|Other | ערך אחר צריך להחזיר 422",
"pm.test('422 Unprocessable | invalid enum value rejected', () => {",
" pm.response.to.have.status(422);",
"});",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Validation error detail present', () => {",
" const res = pm.response.json();",
" pm.expect(res.detail).to.be.an('array').and.not.empty;",
"});"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{testuser_token}}", "type": "string" }] },
"method": "PUT",
"header": [{"key":"Content-Type","value":"application/json"}],
"body": { "mode": "raw", "raw": "{\n \"category\": \"InvalidCategory\"\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/api/recommendations/{{rec_id}}", "host": ["{{BaseURL}}"], "path": ["api","recommendations","{{rec_id}}"] },
"description": "**Negative test:** category הוא enum. ערך לא תקין צריך להחזיר 422."
},
"response": []
}
]
},
{
"name": "Team 3 | Comments & Blacklist",
"description": "GET /api/recommendations/{rec_id}/comments · POST /api/recommendations/{rec_id}/comments · DELETE /api/recommendations/{rec_id}/comments/{comment_id} · GET /api/admin/blacklist · POST /api/admin/blacklist · DELETE /api/admin/blacklist/{entry_id}",
"item": [
{
"name": "✅ Get Comments for Recommendation",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"const res = pm.response.json();",
"pm.test('200 OK', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Response is an array', () => { pm.expect(res).to.be.an('array'); });",
"pm.test('Each comment matches CommentOut schema', () => {",
" if (res.length > 0) {",
" pm.expect(res[0]).to.include.all.keys('id','recommendation_id','commenter_name','rating','comment_text','created_at');",
" }",
"});"
]}
}],
"request": {
"method": "GET",
"header": [{ "key": "accept", "value": "application/json" }],
"url": { "raw": "{{BaseURL}}/api/recommendations/{{rec_id}}/comments", "host": ["{{BaseURL}}"], "path": ["api","recommendations","{{rec_id}}","comments"] },
"description": "**Public endpoint | no auth required**\n**Response 200:** Array of CommentOut → id, recommendation_id, commenter_id, commenter_name, rating, comment_text, created_at"
},
"response": []
},
{
"name": "✅ Add Comment",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"const res = pm.response.json();",
"// CommentOut schema: id, recommendation_id, commenter_id, commenter_name, rating, comment_text, created_at",
"if (res.id) { pm.environment.set('comment_id', res.id); console.log('✅ comment_id:', res.id); }",
"",
"pm.test('201 Created', () => { pm.response.to.have.status(201); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Body matches CommentOut schema', () => {",
" pm.expect(res).to.include.all.keys('id','recommendation_id','commenter_name','rating','comment_text','created_at');",
"});",
"pm.test('Rating matches submitted value (3)', () => { pm.expect(res.rating).to.eql(3); });",
"pm.test('recommendation_id matches rec_id env var', () => {",
" pm.expect(res.recommendation_id).to.eql(pm.environment.get('rec_id'));",
"});"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{testuser_token}}", "type": "string" }] },
"method": "POST",
"header": [{"key":"accept","value":"application/json"},{"key":"Content-Type","value":"application/json"}],
"body": { "mode": "raw", "raw": "{\n \"rating\": 3,\n \"comment_text\": \"Added by automated API test suite\"\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/api/recommendations/{{rec_id}}/comments", "host": ["{{BaseURL}}"], "path": ["api","recommendations","{{rec_id}}","comments"] },
"description": "**Schema:** CommentCreate → rating (required, integer 1-5), comment_text (optional)\n**Auth:** Authorization header required\n**Response 201:** CommentOut"
},
"response": []
},
{
"name": "❌ Add Comment | Rating Out of Range (Negative)",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"// rating: minimum 1, maximum 5 | ערך 6 צריך להחזיר 422",
"pm.test('422 | rating > 5 rejected', () => { pm.response.to.have.status(422); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Validation error detail present', () => {",
" const res = pm.response.json();",
" pm.expect(res.detail).to.be.an('array').and.not.empty;",
"});"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{testuser_token}}", "type": "string" }] },
"method": "POST",
"header": [{"key":"Content-Type","value":"application/json"}],
"body": { "mode": "raw", "raw": "{\n \"rating\": 6,\n \"comment_text\": \"Invalid rating\"\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/api/recommendations/{{rec_id}}/comments", "host": ["{{BaseURL}}"], "path": ["api","recommendations","{{rec_id}}","comments"] },
"description": "**Negative test:** rating maximum הוא 5 לפי schema. שליחת 6 צריכה להחזיר 422."
},
"response": []
},
{
"name": "❌ Add Comment | No Auth (Negative)",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"pm.test('422 or 401 | unauthenticated comment rejected', () => {",
" pm.expect([401,422]).to.include(pm.response.code);",
"});",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });"
]}
}],
"request": {
"auth": { "type": "noauth" },
"method": "POST",
"header": [{"key":"Content-Type","value":"application/json"}],
"body": { "mode": "raw", "raw": "{\n \"rating\": 5,\n \"comment_text\": \"Should be rejected\"\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/api/recommendations/{{rec_id}}/comments", "host": ["{{BaseURL}}"], "path": ["api","recommendations","{{rec_id}}","comments"] },
"description": "**Negative test:** Authorization header required. ציפיה: 422 (missing required header) או 401."
},
"response": []
},
{
"name": "✅ Get Blacklist",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"const res = pm.response.json();",
"pm.test('200 OK', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Response is an array', () => { pm.expect(res).to.be.an('array'); });"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{admin_token}}", "type": "string" }] },
"method": "GET",
"header": [{ "key": "accept", "value": "application/json" }],
"url": { "raw": "{{BaseURL}}/api/admin/blacklist", "host": ["{{BaseURL}}"], "path": ["api","admin","blacklist"] },
"description": "**Admin only**\n**Response 200:** {} (schema לא מוגדר)"
},
"response": []
},
{
"name": "✅ Add Email to Blacklist",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"const res = pm.response.json();",
"const bid = res.id || res.entry_id;",
"if (bid) { pm.environment.set('blacklist_id', bid); console.log('✅ blacklist_id:', bid); }",
"",
"pm.test('201 Created | email blacklisted', () => { pm.response.to.have.status(201); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Blacklist entry id returned', () => {",
" pm.expect(bid).to.exist;",
"});"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{admin_token}}", "type": "string" }] },
"method": "POST",
"header": [{"key":"accept","value":"application/json"},{"key":"Content-Type","value":"application/json"}],
"body": { "mode": "raw", "raw": "{\n \"email\": \"blacklist-test@api-suite.dev\"\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/api/admin/blacklist", "host": ["{{BaseURL}}"], "path": ["api","admin","blacklist"] },
"description": "**Schema:** Body_add_blacklist → email (required)\n**Response 201:** {} (schema לא מוגדר)\nשומר blacklist_id לטירדאון."
},
"response": []
},
{
"name": "❌ Add to Blacklist | Regular Token (Negative)",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"pm.test('401 or 403 | non-admin cannot blacklist', () => {",
" pm.expect([401,403]).to.include(pm.response.code);",
"});",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{testuser_token}}", "type": "string" }] },
"method": "POST",
"header": [{"key":"Content-Type","value":"application/json"}],
"body": { "mode": "raw", "raw": "{\n \"email\": \"unauthorized@test.dev\"\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/api/admin/blacklist", "host": ["{{BaseURL}}"], "path": ["api","admin","blacklist"] },
"description": "**Negative test:** משתמש רגיל לא יכול להוסיף ל-blacklist."
},
"response": []
}
]
},
{
"name": "Team 5 | Cart",
"description": "GET /api/cart · PUT /api/cart",
"item": [
{
"name": "✅ Get Cart",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"const res = pm.response.json();",
"pm.test('200 OK', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"// BUG NOTE: CartBody schema מגדיר {items: array} אבל GET response schema הוא {} (ריק)",
"// בודקים שהתשובה היא object",
"pm.test('Response is a non-null object', () => {",
" pm.expect(typeof res).to.eql('object');",
"});"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{testuser_token}}", "type": "string" }] },
"method": "GET",
"header": [{ "key": "accept", "value": "application/json" }],
"url": { "raw": "{{BaseURL}}/api/cart", "host": ["{{BaseURL}}"], "path": ["api","cart"] },
"description": "**Auth:** Authorization header required\n**Response 200:** {} (schema לא מוגדר)"
},
"response": []
},
{
"name": "✅ Add Item to Cart",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"const res = pm.response.json();",
"// BUG NOTE: PUT response schema הוא {} | לא מוגדר. OpenAPI מגדיר 200 (לא 204)",
"pm.test('200 OK | cart saved', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{testuser_token}}", "type": "string" }] },
"method": "PUT",
"header": [{"key":"accept","value":"application/json"},{"key":"Content-Type","value":"application/json"}],
"body": { "mode": "raw", "raw": "{\n \"items\": [\n { \"rec_id\": \"{{rec_id}}\", \"quantity\": 1 }\n ]\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/api/cart", "host": ["{{BaseURL}}"], "path": ["api","cart"] },
"description": "**Schema:** CartBody → items (required, array of objects)\n**Response 200:** {} (schema לא מוגדר)"
},
"response": []
},
{
"name": "✅ Verify Cart Has Item",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"const res = pm.response.json();",
"pm.test('200 OK', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Cart is not empty after adding item', () => {",
" if (Array.isArray(res.items)) {",
" pm.expect(res.items.length).to.be.above(0);",
" } else if (Array.isArray(res)) {",
" pm.expect(res.length).to.be.above(0);",
" }",
"});"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{testuser_token}}", "type": "string" }] },
"method": "GET",
"header": [{ "key": "accept", "value": "application/json" }],
"url": { "raw": "{{BaseURL}}/api/cart", "host": ["{{BaseURL}}"], "path": ["api","cart"] },
"description": "מאמת שהפריט נשמר בפועל."
},
"response": []
},
{
"name": "❌ Get Cart | No Auth (Negative)",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"pm.test('422 or 401 | unauthenticated cart access rejected', () => {",
" pm.expect([401,422]).to.include(pm.response.code);",
"});",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });"
]}
}],
"request": {
"auth": { "type": "noauth" },
"method": "GET",
"header": [{ "key": "accept", "value": "application/json" }],
"url": { "raw": "{{BaseURL}}/api/cart", "host": ["{{BaseURL}}"], "path": ["api","cart"] },
"description": "**Negative test:** Authorization header required. ציפיה: 422 או 401."
},
"response": []
},
{
"name": "✅ Clear Cart",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"pm.test('200 OK | cart cleared', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{testuser_token}}", "type": "string" }] },
"method": "PUT",
"header": [{"key":"Content-Type","value":"application/json"}],
"body": { "mode": "raw", "raw": "{\n \"items\": []\n}", "options": { "raw": { "language": "json" } } },
"url": { "raw": "{{BaseURL}}/api/cart", "host": ["{{BaseURL}}"], "path": ["api","cart"] },
"description": "שולח items: [] כדי לרוקן את העגלה."
},
"response": []
},
{
"name": "✅ Verify Cart Is Empty",
"event": [{
"listen": "test",
"script": { "type": "text/javascript", "exec": [
"const res = pm.response.json();",
"pm.test('200 OK', () => { pm.response.to.have.status(200); });",
"pm.test('Response time < 5000ms', () => { pm.expect(pm.response.responseTime).to.be.below(5000); });",
"pm.test('Cart is empty after clear', () => {",
" if (Array.isArray(res.items)) { pm.expect(res.items).to.have.lengthOf(0); }",
" else if (Array.isArray(res)) { pm.expect(res).to.have.lengthOf(0); }",
"});"
]}
}],
"request": {
"auth": { "type": "bearer", "bearer": [{ "key": "token", "value": "{{testuser_token}}", "type": "string" }] },
"method": "GET",
"header": [{ "key": "accept", "value": "application/json" }],