You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Development/v4.x/backend/testing/jobs.md
+281-8Lines changed: 281 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -218,7 +218,6 @@ Not all files test PATCH and DELETE methods, as these would be redundant.
218
218
| 0130 | Add a new job as user from CREATE_JOB_PRIVILEGED_GROUPS for different ownerUser and ownerGroup for #datasetAccess, which should be forbidden | POST | /api.v4/Jobs | user1 | 403 |```AccessForbiddenStatusCode```|
219
219
| 0140 | Add a new job as user from CREATE_JOB_PRIVILEGED_GROUPS for different ownerUser and no ownerGroup for #datasetAccess | POST | /api/v4/Jobs | user1 | 201 |```EntryCreatedStatusCode```|
220
220
| 0150 | Add a new job as user from CREATE_JOB_PRIVILEGED_GROUPS for different ownerUser and no ownerGroup for #datasetAccess, which should be forbidden | POST | /api.v4/Jobs | user1 | 403 |```AccessForbiddenStatusCode```|
221
-
222
221
| 0160 | Add a new job as user from CREATE_JOB_PRIVILEGED_GROUPS for anonymous user in #datasetAccess with published datasets | POST | /api.v4/Jobs | user1 | 201 |```EntryCreatedStatusCode```|
223
222
| 0170 | Add a new job as user from CREATE_JOB_PRIVILEGED_GROUPS for anonymous user in #datasetAccess with one unpublished dataset, which should be forbidden | POST | /api.v4/Jobs | user1 | 403 |```AccessForbiddenStatusCode```|
224
223
| 0180 | Add a new job as a normal user for himself/herself in '#datasetAccess' configuration with access to datasets | POST | /api/v4/Jobs | user5.1 | 201 |```EntryCreatedStatusCode```|
@@ -260,7 +259,7 @@ Not all files test PATCH and DELETE methods, as these would be redundant.
260
259
| 0150 | Add a new job as a normal user for himself/herself in '#datasetOwner' configuration with datasets not owned by his/her group, which should be forbidden | POST | /api/v4/Jobs | user5.1 | 403 |```AccessForbiddenStatusCode```|
261
260
| 0160 | Add a new job as a user from ADMIN_GROUPS for group2 and user1 in '#datasetOwner' configuration | POST | /api/v4/Jobs| admin | 200 |```EntryCreatedStatusCode```|
262
261
| 0170 | Add a new job as a user from ADMIN_GROUPS for group1 and user2 in '#datasetOwner' configuration | POST | /api/v4/Jobs | admin | 200 |```EntryCreatedStatusCode```|
263
-
| 0180 | , where the user is not an owner of some of these datasets, which should be forbidden | POST | /api/v4/Jobs | user1 | 403 |```AccessForbiddenStatusCode```|
262
+
| 0180 |Add a new job as a user from CREATE_JOB_PRIVILEGED_GROUPS for another user in '#datasetOwner' configuration, where the user is not an owner of some of these datasets, which should be forbidden | POST | /api/v4/Jobs | user1 | 403 |```AccessForbiddenStatusCode```|
264
263
| 0190 | Add a new job as a user from CREATE_JOB_PRIVILEGED_GROUPS for another user in '#datasetOwner' configuration, where the user is owner of these datasets | POST | /api/v4/Jobs | user1 | 200 |```EntryCreatedStatusCode```|
265
264
| 0200 | Add a new job as a user from CREATE_JOB_PRIVILEGED_GROUPS for group1 and user3 in '#datasetOwner' configuration, which should be forbidden | POST | /api/v4/Jobs | user1 | 403 |```AccessForbiddenStatusCode```|
266
265
| 0210 | Add a new job as a user from CREATE_JOB_PRIVILEGED_GROUPS for anonymous user in '#datasetOwner' configuration, which should be forbidden | POST | /api/v4/Jobs | user1 | 401 |```CreationUnauthorizedStatusCode```|
@@ -308,6 +307,181 @@ Not all files test PATCH and DELETE methods, as these would be redundant.
308
307
| 0140 | Add a new job as anonymous user in '#datasetPublic' configuration with all published datasets | POST | /api/v4/Jobs | unauthenticated | 201 |```EntryCreatedStatusCode```|
309
308
| 0150 | Add a new job as anonymous user in '#datasetPublic' configuration with one unpublished dataset, which should be forbidden | POST | /api/v4/Jobs | unauthenticated | 403 |```AccessForbiddenStatusCode```|
310
309
310
+
### 1165: Jobs test filters and access
311
+
312
+
<table>
313
+
<tr>
314
+
<th>Test Number</th>
315
+
<th>Description</th>
316
+
<th>HTTP Method</th>
317
+
<th>Endpoint</th>
318
+
<th>Filter</th>
319
+
<th>Authenticated User</th>
320
+
<th>Expected Request Status</th>
321
+
<th>Expected Request Code</th>
322
+
</tr>
323
+
<tr>
324
+
<td>0010</td>
325
+
<td>Access jobs as a user from ADMIN_GROUPS with wrong include query</td>
326
+
<td>GET</td>
327
+
<td>/api/v4/Jobs</td>
328
+
<td>
329
+
<pre><code>{
330
+
"include": ["datasets", "datasets.datablocks"]
331
+
}</code></pre>
332
+
</td>
333
+
<td>admin</td>
334
+
<td>400</td>
335
+
<td><code>BadRequestStatusCode</code></td>
336
+
</tr>
337
+
<tr>
338
+
<td>0020</td>
339
+
<td>Access jobs and dataset details as a user from ADMIN_GROUPS with include query, which is not allowed</td>
340
+
<td>GET</td>
341
+
<td>/api/v4/Jobs/datasetDetails</td>
342
+
<td>
343
+
<pre><code>{
344
+
"include": ["datasets", "datasets.datablocks"]
345
+
}</code></pre>
346
+
</td>
347
+
<td>admin</td>
348
+
<td>400</td>
349
+
<td><code>BadRequestStatusCode</code></td>
350
+
</tr>
351
+
<tr>
352
+
<td>0030</td>
353
+
<td>Access jobs as a user from ADMIN_GROUPS with a correct include query and fields query</td>
354
+
<td>GET</td>
355
+
<td>/api/v4/Jobs</td>
356
+
<td>
357
+
<pre><code>{
358
+
"include": ["datasets"],
359
+
"fields": [
360
+
"id",
361
+
"type",
362
+
"datasets.pid",
363
+
"datasets.keywords"
364
+
]
365
+
}</code></pre>
366
+
</td>
367
+
<td>admin</td>
368
+
<td>200</td>
369
+
<td><code>SuccessfulGetStatusCode</code></td>
370
+
</tr>
371
+
<tr>
372
+
<td>0040</td>
373
+
<td>Access jobs as a user from ADMIN_GROUPS with where filter</td>
374
+
<td>GET</td>
375
+
<td>/api/v4/Jobs</td>
376
+
<td>
377
+
<pre><code>{
378
+
"where": {"ownerGroup": "group1"},
379
+
"include": ["datasets"],
380
+
"fields": [
381
+
"id",
382
+
"type",
383
+
"ownerGroup",
384
+
"datasets.pid",
385
+
"datasets.keywords"
386
+
]
387
+
}</code></pre>
388
+
</td>
389
+
<td>admin</td>
390
+
<td>200</td>
391
+
<td><code>SuccessfulGetStatusCode</code></td>
392
+
</tr>
393
+
<tr>
394
+
<td>0050</td>
395
+
<td>Access jobs as a user from ADMIN_GROUPS with an include filter specified as all</td>
396
+
<td>GET</td>
397
+
<td>/api/v4/Jobs</td>
398
+
<td>
399
+
<pre><code>{
400
+
"include": ["all"],
401
+
"fields": [
402
+
"id",
403
+
"type",
404
+
"datasets.pid",
405
+
"datasets.keywords"
406
+
]
407
+
}</code></pre>
408
+
</td>
409
+
<td>admin</td>
410
+
<td>200</td>
411
+
<td><code>SuccessfulGetStatusCode</code></td>
412
+
</tr>
413
+
<tr>
414
+
<td>0060</td>
415
+
<td>Access jobs datasetDetails as a user from ADMIN_GROUPS with no fields query that should return all properties of JobClass</td>
416
+
<td>GET</td>
417
+
<td>/api/v4/Jobs/datasetDetails</td>
418
+
<td></td>
419
+
<td>admin</td>
420
+
<td>200</td>
421
+
<td><code>SuccessfulGetStatusCode</code></td>
422
+
</tr>
423
+
<tr>
424
+
<td>0070</td>
425
+
<td>Access jobs and datasetDetails, information should be returned based on correct access</td>
426
+
<td>GET</td>
427
+
<td>/api/v4/Jobs/datasetDetails</td>
428
+
<td></td>
429
+
<td>user1</td>
430
+
<td>200</td>
431
+
<td><code>SuccessfulGetStatusCode</code></td>
432
+
</tr>
433
+
<tr>
434
+
<td>0080</td>
435
+
<td>Access jobs and datasetDetails, apply fields filter</td>
436
+
<td>GET</td>
437
+
<td>/api/v4/Jobs/datasetDetails</td>
438
+
<td>
439
+
<pre><code>{
440
+
"fields": [
441
+
"id",
442
+
"datasetDetails.pid",
443
+
"datasetDetails.datablocks._id",
444
+
"datasetDetails.datablocks.size",
445
+
"datasetDetails.origdatablocks._id",
446
+
"datasetDetails.origdatablocks.chkAlg"
447
+
]
448
+
}</code></pre>
449
+
</td>
450
+
<td>user1</td>
451
+
<td>200</td>
452
+
<td><code>SuccessfulGetStatusCode</code></td>
453
+
</tr>
454
+
<tr>
455
+
<td>0090</td>
456
+
<td>Access jobs, datasets and instruments, that should be returned based on correct access</td>
457
+
<td>GET</td>
458
+
<td>/api/v4/Jobs/datasetDetails</td>
459
+
<td></td>
460
+
<td>user5.1</td>
461
+
<td>200</td>
462
+
<td><code>SuccessfulGetStatusCode</code></td>
463
+
</tr>
464
+
<tr>
465
+
<td>0100</td>
466
+
<td>Access jobs, datasets and instruments, that should be returned based on correct access</td>
467
+
<td>GET</td>
468
+
<td>/api/v4/Jobs/datasetDetails</td>
469
+
<td></td>
470
+
<td>user3</td>
471
+
<td>200</td>
472
+
<td><code>SuccessfulGetStatusCode</code></td>
473
+
</tr>
474
+
<tr>
475
+
<td>0110</td>
476
+
<td>Access jobs, datasets and instruments, that should be returned based on correct access</td>
477
+
<td>GET</td>
478
+
<td>/api/v4/Jobs/datasetDetails</td>
479
+
<td></td>
480
+
<td>adminIngestor</td>
481
+
<td>200</td>
482
+
<td><code>SuccessfulGetStatusCode</code></td>
483
+
</tr>
484
+
</table>
311
485
312
486
### 1170: Jobs: Test New Job Model Authorization for job_admin jobs type
313
487
| Test Number | Description | HTTP Method | Endpoint | Authenticated User | Expected Request Status | Expected Request Code |
@@ -316,13 +490,13 @@ Not all files test PATCH and DELETE methods, as these would be redundant.
316
490
| 0020 | Add dataset 2 as Admin Ingestor | POST | /api/v3/Datasets | adminIngestor | 201 |```EntryCreatedStatusCode```|
317
491
| 0030 | Add dataset 3 as Admin Ingestor | POST | /api/v3/Datasets | adminIngestor | 201 |```EntryCreatedStatusCode```|
318
492
| 0040 | Add a new job as a user from ADMIN_GROUPS for himself/herself in '#jobAdmin' configuration | POST | /api/v4/Jobs | admin | 201 |```EntryCreatedStatusCode```|
319
-
| 0050 | Add a new job as a user from ADMIN_GROUPS for another user in '#jobAdmin' configuration POST | /api/v4/Jobs | admin | 201 |```EntryCreatedStatusCode```|
320
-
| 0060 | Add a new job as a user from ADMIN_GROUPS for another group in '#jobAdmin' configuration POST | /api/v4/Jobs | admin | 201 |```EntryCreatedStatusCode```|
493
+
| 0050 | Add a new job as a user from ADMIN_GROUPS for another user in '#jobAdmin' configuration | POST | /api/v4/Jobs | admin | 201 |```EntryCreatedStatusCode```|
494
+
| 0060 | Add a new job as a user from ADMIN_GROUPS for another group in '#jobAdmin' configuration | POST | /api/v4/Jobs | admin | 201 |```EntryCreatedStatusCode```|
321
495
| 0070 | Add a new job as a user from ADMIN_GROUPS for anonymous user in '#jobAdmin' configuration | POST | /api/v4/Jobs | admin | 201 |```EntryCreatedStatusCode```|
322
496
| 0080 | Add a new job as a user from CREATE_JOB_PRIVILEGED_GROUPS for himself/herself in '#jobAdmin' configuration with dataset owned by his/her group | POST | /api/v4/Jobs | user1 | 201 |```EntryCreatedStatusCode```|
323
497
| 0090 | Add a new job as a user from CREATE_JOB_PRIVILEGED_GROUPS for himself/herself in '#jobAdmin' configuration with only one of two datasets owned by his/her group | POST | /api/v4/Jobs | user1 | 201 |```EntryCreatedStatusCode```|
324
-
| 0100 | Add a new job as a user from CREATE_JOB_PRIVILEGED_GROUPS for another user in '#jobAdmin' configuration POST | /api/v4/Jobs | user1 | 201 |```EntryCreatedStatusCode```|
325
-
| 0110 | Add a new job as a normal user for himself/herself in '#jobAdmin' configuration with datasets owned by his/her group, which should be forbidden POST | /api/v4/Jobs | user51 | 403 |```AccessForbiddenStatusCode```|
498
+
| 0100 | Add a new job as a user from CREATE_JOB_PRIVILEGED_GROUPS for another user in '#jobAdmin' configuration | POST | /api/v4/Jobs | user1 | 201 |```EntryCreatedStatusCode```|
499
+
| 0110 | Add a new job as a normal user for himself/herself in '#jobAdmin' configuration with datasets owned by his/her group, which should be forbidden | POST | /api/v4/Jobs | user51 | 403 |```AccessForbiddenStatusCode```|
326
500
| 0120 | Add a new job as a user from UPDATE_JOB_PRIVILEGED_GROUPS for himself/herself in '#jobAdmin' configuration with datasets owned by his/her group, which should be forbidden | POST | /api/v4/Jobs | user3 | 403 |```AccessForbiddenStatusCode```|
327
501
| 0130 | Add a status update to a job as a user from ADMIN_GROUPS for his/her job in '#jobAdmin' configuration | PATCH | /api/v4/Jobs/${encodedJobOwnedByAdmin} | Admin | 200 |```SuccessfulPatchStatusCode```|
328
502
| 0140 | Add a Status update to a job as a user from ADMIN_GROUPS for another group's job in '#jobAdmin' configuration | PATCH | /api/v4/Jobs/${encodedJobOwnedByUser1} | Admin | 200 |```SuccessfulPatchStatusCode```|
@@ -349,7 +523,7 @@ Not all files test PATCH and DELETE methods, as these would be redundant.
349
523
| 0090 | Add a new job as a user from ADMIN_GROUPS for anonymous user in '#@group5' configuration | POST | /api/v4/Jobs | admin | 201 |```EntryCreatedStatusCode```|
350
524
| 0100 | Add a new job as a user from CREATE_JOB_PRIVILEGED_GROUPS for his/her own group in '#@group5' configuration | POST | /api/v4/Jobs | user1 | 201 |```EntryCreatedStatusCode```|
351
525
| 0110 | Add a new job as a user from CREATE_JOB_PRIVILEGED_GROUPS for user 5.1 in '#@group5' configuration | POST | /api/v4/Jobs | user1 | 201 |```EntryCreatedStatusCode```|
352
-
| 0120 | Add a new job as a user from CREATE_JOB_PRIVILEGED_GROUPS for user 4 in '#@group5' configuration | POST | /api/v4/Jobs/ user1 | 201 |```EntryCreatedStatusCode```|
526
+
| 0120 | Add a new job as a user from CREATE_JOB_PRIVILEGED_GROUPS for user 4 in '#@group5' configuration | POST | /api/v4/Jobs/ |user1 | 201 |```EntryCreatedStatusCode```|
353
527
| 0130 | Add a new job as a user from UPDATE_JOB_PRIVILEGED_GROUPS for user 5.1 in '#@group5' configuration, which should be forbidden | POST | /api/v4/Jobs | user3 | 403 |```AccessForbiddenStatusCode```|
354
528
| 0140 | Add a new job as a user 5.1 for himself/herself in '#@group5' configuration | POST | /api/v4/Jobs | user5.1 | 201 |```EntryCreatedStatusCode```|
355
529
| 0150 | Add a new job as a user 5.1 for another user in his/her group in '#@group5' configuration | POST | /api/v4/Jobs | user5.1 | 201 |```EntryCreatedStatusCode```|
@@ -431,7 +605,7 @@ Not all files test PATCH and DELETE methods, as these would be redundant.
431
605
| 0380 | Fullfacet jobs as a user from ADMIN_GROUPS that were created by User5.1 | GET | /api/v4/Jobs/fullfacet?createdBy=user5.1 | admin | 200 |```SuccessfulGetStatusCode```|
432
606
433
607
434
-
### 1200: Jobs: Test Backwards Compatibility
608
+
### 1191: Jobs: Test Backwards Compatibility
435
609
436
610
| Test Number | Description | HTTP Method | Endpoint | Authenticated User | Expected Request Status | Expected Request Code |
@@ -478,3 +652,102 @@ Not all files test PATCH and DELETE methods, as these would be redundant.
478
652
| 0410 | Get via /api/v3 the anonymous job as a user in CREATE_JOB_PRIVILEGED_GROUPS | GET | /api/v3/Jobs/${encodedJobAnonymous} | user2 | 200 |```SuccessfulGetStatusCode```|
479
653
| 0420 | Add via /api/v3 a new job for user5.1, as user5.1 in #datasetAccess auth | POST | /api/v3/Jobs | user5.1 | 201 |```EntryCreatedStatusCode```|
480
654
| 0430 | Get via /api/v4 the previously added job, as user5.1 | GET | /api/v3/Jobs/${encodedJobOwnedByUser51} | user5.1 | 200 |```SuccessfulGetStatusCode```|
655
+
656
+
657
+
### 1192: Jobs: Test datasetDetails backwards Compatibility
658
+
659
+
<table>
660
+
<tr>
661
+
<th>Test Number</th>
662
+
<th>Description</th>
663
+
<th>HTTP Method</th>
664
+
<th>Endpoint</th>
665
+
<th>Filter</th>
666
+
<th>Authenticated User</th>
667
+
<th>Expected Request Status</th>
668
+
<th>Expected Request Code</th>
669
+
</tr>
670
+
<tr>
671
+
<td>0010</td>
672
+
<td>Get job and details on dataset for specific jobID and including information on datasets and datablocks as a user from ADMIN_GROUP with v4 endpoint</td>
673
+
<td>GET</td>
674
+
<td>/api/v4/Jobs/datasetDetails</td>
675
+
<td>
676
+
<pre><code>{
677
+
"where": {"id": "${encodedJob}"},
678
+
"fields": [
679
+
"datasetDetails.pid",
680
+
"datasetDetails.owner",
681
+
"datasetDetails.contactEmail",
682
+
"datasetDetails.sourceFolder",
683
+
"datasetDetails.type",
684
+
"datasetDetails.classification",
685
+
"datasetDetails.ownerGroup",
686
+
"datasetDetails.datasetlifecycle",
687
+
"datasetDetails.datablocks.archiveId",
688
+
"datasetDetails.datablocks.size",
689
+
"datasetDetails.datablocks._id"
690
+
]
691
+
}</code></pre>
692
+
</td>
693
+
<td>admin</td>
694
+
<td>200</td>
695
+
<td><code>SuccessfulGetStatusCode</code></td>
696
+
</tr>
697
+
<tr>
698
+
<td>0020</td>
699
+
<td>Should return dataset details from V3 endpoint for a specific job and include datablocks information as a user from ADMIN_GROUP</td>
700
+
<td>GET</td>
701
+
<td>/api/v3/Jobs/datasetDetails</td>
702
+
<td>
703
+
<pre><code>{
704
+
jobId=${encodedJob}&
705
+
datasetFields={
706
+
"pid": true,
707
+
"sourceFolder": true,
708
+
"sourceFolderHost": true,
709
+
"contactEmail": true,
710
+
"owner": true,
711
+
"ownerGroup": true,
712
+
"classification": true,
713
+
"type": true,
714
+
"datasetlifecycle": true,
715
+
"createdBy": true
716
+
}&include={
717
+
"relation":"datablocks"
718
+
}&includeFields={
719
+
"_id": true,
720
+
"archiveId": true,
721
+
"size": true,
722
+
"datasetId": true
723
+
}</code></pre>
724
+
</td>
725
+
<td>admin</td>
726
+
<td>200</td>
727
+
<td><code>SuccessfulGetStatusCode</code></td>
728
+
</tr>
729
+
<tr>
730
+
<td>0030</td>
731
+
<td>Should return dataset details from V3 endpoint for a specific job and include no further information as a user from ADMIN_GROUP</td>
0 commit comments