llama_3_3epochs / test.csv
Surabhi-K's picture
Upload 10 files
d5e4cbd verified
raw
history blame contribute delete
No virus
23.2 kB
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
"