File size: 23,228 Bytes
d5e4cbd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
Endpoint,Description,Inputs,Output,Test_Code
/config/rest/delete/,requesting to delete the config values when provided valid config name but with invalid token,"config_value = { ""name"": ""primary_server"" }","{
    ""status"": 401,
    ""message"": ""Invalid token""
}
","def test_config_delete_with_invalid_token(invalid_exec_api):
    """"""
    deleting the non deletable config values with invalid token
    """"""
    config_value = {
        ""name"": ""primary_server"",
    }
    r = invalid_exec_api.config_delete(config_value)
    test_assert.status(r, 401)
    result = r.json()
    assert result['detail'] == ""Invalid token.""
"
/config/rest/version/,Fetching the information when invalid token is provided,,"{
""status"":401,
""message"":""invalid token""
}","def test_version_config_with_invalid_token(invalid_exec_api):
    """"""
    Fetching the information of Version and Build Number with invalid token
    """"""
    r = invalid_exec_api.config_version()
    result = r.json()
    test_assert.status(r, 401)
    assert result['detail'] == ""Invalid token."""
"/deploy/rest/delete/{UUID}/

","the manager deletes the image when the manager has rights over the user and the server
",,"{
""status"":204
}","endpoint = ""deploy_delete""

PARAMETERS = [{""dest_obj"": OBJ_DEPL}]
PARAMETERS_SRV_RIGHT = [{""dest_obj"": OBJ_DEPL, ""deploy_with"": SRV_MANAGER_RIGHTS}]
PARAMETERS_NO_SRV_RIGHT = [{""dest_obj"": OBJ_DEPL, ""deploy_with"": SRV_NO_MANAGER_RIGHTS}]

@pytest.mark.parametrize(""custom_lib_non_admin_operations"", PARAMETERS_SRV_RIGHT, indirect=True)
@pytest.mark.parametrize(""custom_lib_admin_operations"", PARAMETERS_SRV_RIGHT, indirect=True)

def test_deploy_delete_manager_server_right(skip_if_not_manager, custom_lib_admin_operations, custom_lib_non_admin_operations, run_api):
    """"""
    Deleting the VM by Manager
    """"""
    # When the user is not part of the group that the manager manages and deployment is on manager rights to server
    deploy_id = custom_lib_admin_operations
    r = run_api.deploy_image_delete(deploy_id, {})
    test_assert.status(r, manager_rights_response(endpoint, manages_user=False, manages_server=True))

    # When the user is part of the group that the manager manages and deployment is on manager rights to server
    deploy_id = custom_lib_non_admin_operations
    r = run_api.deploy_image_delete(deploy_id, {})
    test_assert.status(r, manager_rights_response(endpoint, manages_user=True, manages_server=True))"
/deploy/rest/shutdown/{{UUID}}/,shutting down the deployment of machine by an admin using valid UUID and machine is in running state,,"{
""status"" : 201, 
""response"" : Machine shutdown
}","PARAMETERS = [{""dest_obj"": OBJ_DEPL, ""final_state"": DEPL_STATE[""running""]}]

@pytest.mark.parametrize(""custom_lib_non_admin_operations"", PARAMETERS, indirect=True)
def test_deploy_shutdown_admin(skip_if_not_admin, custom_lib_non_admin_operations, run_api):
    """"""
    shutdown the VM by Admin
    """"""
    deploy_id = custom_lib_non_admin_operations
    r = run_api.deploy_shutdown(deploy_id)
    test_assert.status(r, 201)

"
/deploy/rest/stop/{{UUID}}/,stopping a machine by an admin when valid UUID is provided and machine is in running state,,"{
""status"" : 201,
""response""  : stopping deployment
}","endpoint = ""deploy_stop""

PARAMETERS = [{""dest_obj"": OBJ_DEPL, ""final_state"": DEPL_STATE[""running""]}]
PARAMETERS_SRV_RIGHT = [{""dest_obj"": OBJ_DEPL, ""final_state"": DEPL_STATE[""running""], ""deploy_with"": SRV_MANAGER_RIGHTS}]
PARAMETERS_NO_SRV_RIGHT = [{""dest_obj"": OBJ_DEPL, ""final_state"": DEPL_STATE[""running""], ""deploy_with"": SRV_NO_MANAGER_RIGHTS}]

@pytest.mark.parametrize(""custom_lib_non_admin_operations"", PARAMETERS, indirect=True)
def test_deploy_stop_admin(skip_if_not_admin, custom_lib_non_admin_operations, run_api):
    """"""
    Rebooting the VM by Admin
    """"""
    # Admin check of Starting a deployment created by different user
    deploy_id = custom_lib_non_admin_operations
    r = run_api.deploy_stop(deploy_id)
    test_assert.status(r, 201)
"
/deploy/rest/stop/{{UUID}}/,stopping a machine by non-admin user when valid UUID is provided and machine is in running state,,"{
""status"" : 403
}","endpoint = ""deploy_stop""

PARAMETERS = [{""dest_obj"": OBJ_DEPL, ""final_state"": DEPL_STATE[""running""]}]
PARAMETERS_SRV_RIGHT = [{""dest_obj"": OBJ_DEPL, ""final_state"": DEPL_STATE[""running""], ""deploy_with"": SRV_MANAGER_RIGHTS}]
PARAMETERS_NO_SRV_RIGHT = [{""dest_obj"": OBJ_DEPL, ""final_state"": DEPL_STATE[""running""], ""deploy_with"": SRV_NO_MANAGER_RIGHTS}]

@pytest.mark.parametrize(""custom_lib_admin_operations"", PARAMETERS, indirect=True)
def test_deploy_stop_non_admin(skip_if_not_non_admin, custom_lib_admin_operations, run_api):
    """"""
    stopping the VM by non-admin
    """"""
    deploy_id = custom_lib_admin_operations
    r = run_api.deploy_stop(deploy_id)
    test_assert.status(r, 403)
"
/deploy/rest/stop/{{UUID}}/,"stopping a machine deployment by a manager when valid UUID is provided and machine is in running state , and manager has rights over servers",,,"endpoint = ""deploy_stop""

PARAMETERS = [{""dest_obj"": OBJ_DEPL, ""final_state"": DEPL_STATE[""running""]}]
PARAMETERS_SRV_RIGHT = [{""dest_obj"": OBJ_DEPL, ""final_state"": DEPL_STATE[""running""], ""deploy_with"": SRV_MANAGER_RIGHTS}]
PARAMETERS_NO_SRV_RIGHT = [{""dest_obj"": OBJ_DEPL, ""final_state"": DEPL_STATE[""running""], ""deploy_with"": SRV_NO_MANAGER_RIGHTS}]

@pytest.mark.parametrize(""custom_lib_non_admin_operations"", PARAMETERS_SRV_RIGHT, indirect=True)
@pytest.mark.parametrize(""custom_lib_admin_operations"", PARAMETERS_SRV_RIGHT, indirect=True)
def test_deploy_stop_manager_server_right(skip_if_not_manager, custom_lib_admin_operations, custom_lib_non_admin_operations, run_api):
    """"""
    stopping the VM by manager when have right on server
    """"""
    # When the user is not part of the group that the manager manages
    deploy_id = custom_lib_admin_operations
    r = run_api.deploy_stop(deploy_id)
    test_assert.status(r, manager_rights_response(endpoint, manages_user=False, manages_server=True))

    # When the user is part of the group that the manager manages and deployment is on manager rights to server
    deploy_id = custom_lib_non_admin_operations
    r = run_api.deploy_stop(deploy_id)
    test_assert.status(r, manager_rights_response(endpoint, manages_user=True, manages_server=True))
    run_api.deploy_stop(deploy_id)

"
/deploy/rest/stop/{{UUID}}/,"stopping a machine deployment by a manager when valid UUID is provided and machine is in running state , but manager do not have rights over servers",,,"endpoint = ""deploy_stop""

PARAMETERS = [{""dest_obj"": OBJ_DEPL, ""final_state"": DEPL_STATE[""running""]}]
PARAMETERS_SRV_RIGHT = [{""dest_obj"": OBJ_DEPL, ""final_state"": DEPL_STATE[""running""], ""deploy_with"": SRV_MANAGER_RIGHTS}]
PARAMETERS_NO_SRV_RIGHT = [{""dest_obj"": OBJ_DEPL, ""final_state"": DEPL_STATE[""running""], ""deploy_with"": SRV_NO_MANAGER_RIGHTS}]

@pytest.mark.parametrize(""custom_lib_non_admin_operations"", PARAMETERS_NO_SRV_RIGHT, indirect=True)
@pytest.mark.parametrize(""custom_lib_admin_operations"", PARAMETERS_NO_SRV_RIGHT, indirect=True)
def test_deploy_stop_manager_no_server_right(skip_if_not_manager, custom_lib_admin_operations, custom_lib_non_admin_operations, run_api):
    """"""
    stopping the VM by manager when have no right on server
    """"""
    # When the user is not part of the group that the manager manages and the deployment is not on manager rightful server
    deploy_id = custom_lib_admin_operations
    r = run_api.deploy_stop(deploy_id)
    test_assert.status(r, manager_rights_response(endpoint, manages_user=False, manages_server=False))

    # When the user is part of the group that the manager manages but the deployment is not on manager rightful server
    deploy_id = custom_lib_non_admin_operations
    r = run_api.deploy_stop(deploy_id)
    test_assert.status(r, manager_rights_response(endpoint, manages_user=True, manages_server=False))

"
/ilibrary/rest/add/,creating an island library and adding it using invalid IPs,"{
        ""name"": ""test_ilibrary_add_invalid_ips"",
        ""is_public"": True,
        ""network_segments"": {
            ""add"": [
                {
                    ""name"": ""network_segment"",
                    ""bridge_ip"": ""1921681000"",
                    ""start_ip"": ""1921681001"",
                    ""end_ip"": ""192168100150""
                }
            ]
        }
    }","{
""status"" : 400,
""message"" : ""Enter valid IPv4 addresses""
}","
def test_ilibrary_add_invalid_ips(run_api):
    """"""
    Creating an Island Library with invalid bridge ip, start ip, end ip
    """"""
    params = {
        ""name"": ""test_ilibrary_add_invalid_ips"",
        ""is_public"": True,
        ""network_segments"": {
            ""add"": [
                {
                    ""name"": ""network_segment"",
                    ""bridge_ip"": ""1921681000"",
                    ""start_ip"": ""1921681001"",
                    ""end_ip"": ""192168100150""
                }
            ]
        }
    }
    params, r = run_api.ilibrary_add_new_island(params=params)
    test_assert.status(r, 400)
    rjson = r.json()
    errors = rjson['network_segments']['add'][0]
    assert errors['start_ip'] == ['Enter a valid IPv4 address.']
    assert errors['end_ip'] == ['Enter a valid IPv4 address.']
    assert errors['bridge_ip'] == ['Enter a valid IPv4 address.']
"
/ilibrary/rest/details/{UUID}/,fetching details of public island library from private island,"machine1 = {
        ""uuid"": r1.json()[""uuid""],
        ""nics"": {
            ""add"": [
                {
                    ""mac"": ""auto"",
                    ""type"": ""bridge"",
                    ""model"": networks[0].get(""model"", ""virtio""),
                    ""segment"": ""Default Public Segment""
                },

            ],
        }

    }
    params = {
        ""name"": ""Machine1"",
        ""is_public"": False,
        ""machines"": {
            ""add"": [machine1],
        },
    }","{
    ""response"" : success
}","def test_ilibrary_details_with_edit_private_island_to_public_island(skip_if_not_admin, run_api):
    """"""
       To check machine type with public island
    """"""
    params1, r1 = run_api.library_add_new_vm(networks=networks)
    machine1 = {
        ""uuid"": r1.json()[""uuid""],
        ""nics"": {
            ""add"": [
                {
                    ""mac"": ""auto"",
                    ""type"": ""bridge"",
                    ""model"": networks[0].get(""model"", ""virtio""),
                    ""segment"": ""Default Public Segment""
                },

            ],
        }

    }
    params = {
        ""name"": ""Machine1"",
        ""is_public"": False,
        ""machines"": {
            ""add"": [machine1],
        },
    }
    params, r = run_api.ilibrary_add_new_island(params=params)
    island_id = r.json()[""uuid""]
    params, r = run_api.ilibrary_edit_island(uuid=island_id, params={""is_public"": True})
    res = r.json()[""machines""]
    run_api.ilibrary_delete(uuid=island_id)
    run_api.library_delete(r1.json()[""uuid""])
    for machine in res:
        if not machine[""is_public""]:
            assert False, ""The json is %s"" % r.json()

"
/library/rest/add,adding vm to library when multiple boot disks and same order is passed,"disks = [{ ""size"": 20, ""port"": ""sdb"", ""type"": ""sata"", ""format"": ""qcow2"", ""is_boot"": True, ""boot_order"": 1 }, { ""size"": 20, ""port"": ""sda"", ""type"": ""sata"", ""format"": ""qcow2"", ""is_boot"": True, ""boot_order"": 1 }]","{
""status"" : 400,
""response"" : Bad request
}","def test_add_vm_to_library_multiple_bootable_disk_with_same_boot_order(run_api):
    """"""
    If multiple bootable cds with same boot order is passed
    """"""

    disks = [{
        ""size"": 20,
        ""port"": ""sdb"",
        ""type"": ""sata"",
        ""format"": ""qcow2"",
        ""is_boot"": True,
        ""boot_order"": 1
    },
        {
            ""size"": 20,
            ""port"": ""sda"",
            ""type"": ""sata"",
            ""format"": ""qcow2"",
            ""is_boot"": True,
            ""boot_order"": 1
    }]

    params, response = run_api.library_add_new_vm(disks=disks, noraise=True)
    test_assert.status(response, 400)
"
/library/rest/adddisk/{{UUID}}/ ,adding disk to library when provided lib_UUID that does not exist,"lib_UUID = ""doesnotexist""","{
""status"" : 404
}","def test_lib_add_disk_with_invalid_UUID(run_api):
    lib_UUID = ""doesnotexist""
    r = run_api.library_add_disk(lib_UUID)
    test_assert.status(r, 404)
"
/library/rest/ctypes/,getting the console type when requested,,"{
""status"" : 200,
""response"" :  console type details displayed
}","def test_library_ctypes(run_api):
    """"""
    Getting the list of console type
    """"""
    r = run_api.library_console_types()
    result = r.json()
    test_assert.status(result, LIBRARY_CONSOLE_TYPE, ""library_ctypes"")
    test_assert.status(r, 200)
"
/library/rest/delete/{UUID}/,deleting a library by non-admin when provided with valid UUID,,"{
""status"" : 403
}","PARAMETERS = [{""dest_obj"": OBJ_LIB}]

@pytest.mark.parametrize(""custom_lib_admin_operations"", PARAMETERS, indirect=True)
def test_lib_delete_non_admin(skip_if_not_non_admin, custom_lib_admin_operations, run_api):
    """"""
    Deleting the Library by non-Admin
    """"""
    # Non-admin check for deleting the Library created by different user.
    lib_id = custom_lib_admin_operations
    r = run_api.library_delete(lib_id, {})
    test_assert.status(r, 403)

"
/library/rest/edit/{UUID}/,deletion of disk when invalid UUID provided,"{""delete"": [
        {
            ""UUID"": disk_UUID,
            ""port"": ""sdz"",
            ""type"": r['hw']['disks'][0]['type']
        }
    ]
    }","{
""status"" : 404,
""message"" :  ""Disk with UUID does not exist""
}","def test_library_edit_delete_invalid_disk_UUID(library_add_new_vm, run_api):
    """"""
    delete disk with invalid UUID
    """"""
    p, r = library_add_new_vm
    lib_id = r['UUID']
    disk_UUID = str(UUID.UUID4())
    disk_UUID = 'invalid'
    disks = {""delete"": [
        {
            ""UUID"": disk_UUID,
            ""port"": ""sdz"",
            ""type"": r['hw']['disks'][0]['type']
        }
    ]
    }
    params = {""hw"": {""disks"": disks}}
    res = run_api.library_edit(lib_id, params)
    test_assert.status(res, 404)
    rjson = res.json()
    assert rjson['error'] == f""Disk with UUID {disk_UUID} does not exist"", ""|> json %s"" % rjson
"
/library/rest/edit/{UUID}/,updation of library when is_public flag set to True,"params = { ""is_public"": True, ""hw"": {} }","{
""status"" : 400,
""message"" : ""Failed to create task to sync public layers on primary""
}","def test_library_edit_update_is_public_flag(skip_if_not_non_admin, library_add_new_vm, run_api):
    """"""
    Update is_public flag
    """"""
    p, res = library_add_new_vm
    UUID = res['UUID']
    params = {
        ""is_public"": True,
        ""hw"": {}
    }
    r = run_api.library_edit(UUID, params)
    test_assert.status(r, 400)
    rjson = r.json()
    assert rjson['error'] == ""Failed to create task to sync public layers on primary"", ""Json |> %s"" % rjson
"
/library/rest/edit/{UUID}/,updation of network in a library with valid data,"networks = [{
        ""type"": ""bridge"",
        ""model"": ""virtio"",
        ""segment"": ""Default Public Segment"",
    }
    ]

update_network = [{
        ""type"": ""host"",
        ""model"": ""virtio"",
        ""segment"": ""HostOnly Segment"",
    }]

","{
""status"" : 201
}","def test_library_edit_network_with_valid_data(run_api):
    """"""
    edit network with valid data
    """"""
    networks = [{
        ""type"": ""bridge"",
        ""model"": ""virtio"",
        ""segment"": ""Default Public Segment"",
    }
    ]
    params, r = run_api.library_add_new_vm(networks=networks)
    update_netork = [{
        ""type"": ""host"",
        ""model"": ""virtio"",
        ""segment"": ""HostOnly Segment"",
    }]
    params = {'hw': {'networks': update_netork}}
    lib_id = r.json()[""UUID""]
    res = run_api.library_edit(lib_id, params)
    test_assert.status(res, 201)
    rjson = res.json()
    new_network = rjson['hw']['networks'][0]
    assert new_network['type'] == 'host', ""|> Error %s"" % rjson
    assert new_network['segment'] == 'HostOnly Segment', ""|> Error %s"" % rjson
    run_api.library_delete(lib_id, {})
"
​/library​/rest​/hvmtypes​/,fetching the hypervisor type when requested,,"{
""status"" : 200,
""response"" : list of hypervisor type
}","def test_library_hvmtypes(run_api):
    """"""
    Getting the list of Hypervisor type
    """"""
    r = run_api.library_hvmtypes()
    result = r.json()
    test_assert.status(result, LIBRARY_HVM_TYPE, ""library_hvmtypes"")
    test_assert.status(r, 200)
"
/library/rest/revisions/,requesting the revision list of library when machine_UUID is empty,"{
machine_UUID : ''
}","{
""status"" : 400,
""message"" : ""Machine UUID should be provided""}","def test_library_revisions_without_UUID(run_api):
    """"""
    Without UUID
    """"""
    res = run_api.library_revisions("""")
    test_assert.status(res, 400)
    rjson = res.json()
    assert rjson['detail'] == ""Machine UUID should be provided"", ""|> The error %s"" % rjson
"
​/rtask​/rest​/rlist​/,fetching the list of remote tasks without authorization,,"{
""status"" : 401,
""message"" : ""Authentication credentials were not provided""
}","def test_rtask_rlist_without_authorization(anonymous_exec_api):
    """"""
    Fetching the List of Jobs without authorization
    """"""
    r = anonymous_exec_api.rtask_rlist()
    res = r.json()
    test_assert.status(r, 401)
    assert res['detail'] == ""Authentication credentials were not provided.""
"
ideploy/rest/change_ownership,Successful change of ownership from one user to another where both users exist and the requester has the necessary permissions.,"{
        ""deployment_UUIDs"": [UUID],
        ""owner"": ,
        ""dest_user"": ""manager""
}","{""status"": 200, ""message"": ""Operation performed successfully without any error""}","def test_deploy_change_ownership(skip_if_non_admin, non_admin_exec_api, run_api):
    """"""
    To change ownership of deployed machine from non-admin user to manager by admin
    """"""
    params, r = non_admin_exec_api.library_add_new_vm()
    lib_id = r.json()[""UUID""]
    r = non_admin_exec_api.deploy_image(lib_id=lib_id, deploy_on=list(run_api.clm_my_servers.keys()))
    UUID = r.json()['UUID']
    params = {
        ""deployment_UUIDs"": [UUID],
        ""owner"": non_admin_exec_api.user,
        ""dest_user"": ""manager""
    }
    res = run_api.deploy_change_ownership(params=params)
    test_assert.status(res, 200)
    new_owner = run_api.deploy_details(deploy_id=UUID).json()['owner']
    assert new_owner == ""manager""
    run_api.deploy_image_delete(deploy_id=UUID)
    run_api.library_delete(UUID=lib_id)
"
"license/rest/licenses_check
"," when day params is negative
","{
""days"" : -1
}","{
""status:200,
""message"": ""Value of `days` cannot be negative""
}","def test_license_check_when_day_is_negative(run_api):
    """"""
    license check when day is negative
    """"""
    r = run_api.license_check(days=-1)
    rjson = r.json()
    test_assert.status(r, 400)
    assert rjson['error'] == ""Value of `days` cannot be negative"", ""The error %s"" % rjson"
/deploy/rest/deploylist,"getting list of image of deployed machine by setting scope to ""my"". Check the user type before performing the operation, only admin user type have the permission to perform such operations.","{
scope : ""my""
}","{
    ""response"" : success
}","def test_deploy_list_filter_with_scope_my(run_api, admin_exec_api, library_add_new_vm):
    """"""
    filter deploy list using scope = my
    """"""
    params, r = library_add_new_vm
    lib_id = r[""uuid""]
    r = admin_exec_api.deploy_image(lib_id)
    deploy_id = r.json()[""uuid""]
    count = check_count_deploylist(run_api, deploy_id, params={'scope': 'my', 'uuid': deploy_id})

    if run_api.user_type == USER_TYPE['non_admin'] or run_api.user_type == USER_TYPE['manager']:
        assert count == 0
    elif run_api.user_type == USER_TYPE['admin']:
        assert count == 1

    r = admin_exec_api.deploy_image_delete(deploy_id)
"
/config/rest/set/,"setting the None value to secret config. Check the user type before performing the operation, only admin user type have the permission to perform such operations.
","{
        ""name"": ""secret"",
        ""value"": None
}","{
""status"" : 400,
""response"" :  'Invalid secret_key Value' 
}","def test_config_None_set_secret(run_api):
    """"""
    Set the secret-key config value as None
    """"""
    config_value = {
        ""name"": ""secret"",
        ""value"": None
    }
    r = run_api.config_set(config_value)
    res = r.json()
    if run_api.user_type in [USER_TYPE[""manager""], USER_TYPE[""non_admin""]]:
        test_assert.status(r, 403)
    elif run_api.user_type == USER_TYPE['admin']:
        test_assert.status(r, 400)
        assert res[""result""] == 'FAILURE'
        assert 'Invalid secret_key Value' in res[""error""], res


"
/group/rest/add/,"adding new group when group name field is missing. Check the user type before performing the operation, only admin user type have the permission to perform such operations.
",,"{
""status"" : 400,
""message"" : ""Group Name is required and it can not be blank""
}","def test_add_group_with_group_name_field_missing(run_api):
    """"""
    Adding new Group with group name field missing
    """"""
    params, r = run_api.group_add(template={})
    if run_api.user_type in [USER_TYPE[""non_admin""], USER_TYPE[""manager""]]:
        test_assert.status(r, 403)
    elif run_api.user_type == USER_TYPE[""admin""]:
        result = r.json()
        test_assert.status(r, 400)
        assert result['error'] == ""Group Name is required and it can not be blank""

"
/group/rest/update/,"updating the deployment strategy of a group using an invalid value. Check the user type before performing the operation, only admin user type have the permission to perform such operations.
","{
        ""name"",
        ""deployment_strategy"": 'invalid'
    }","{
    ""status"" : 400,
    ""message"" : ""Invalid deployment_strategy""
}","def test_group_update_invalid_deployment_strategy(skip_if_not_admin, group_add, run_api):
    """"""
    group update invalid deployment_strategy
    """"""
    params, r = group_add
    rjson = r.json()
    group_id = rjson['id']
    group_param = {
        ""name"": rjson['name'],
        ""deployment_strategy"": 'invalid'
    }
    updated_param, r = run_api.group_update(group_id, group_param)
    run_api.user_type == USER_TYPE[""admin""]
    result = r.json()
    test_assert.status(r, 400)
    assert result['error'] == ""Invalid deployment_strategy"", ""|> Json %s"" % result
"