res = r.create_reservation([restricted_id1], millis, millis2, 't', 'd')
is_success(desc, res)
r1_id = get_id(res)

desc = '### create reservation on restricted2 and one unrestricted ###'
res = r.create_reservation([restricted_id1, free_id], millis+1, millis3, 't', 'd')
is_success(desc, res)
r2F_id = get_id(res)

desc = '### create reservation on both restricted resources ###'
res = r.create_reservation([restricted_id2, restricted_id1], millis, millis4, 't', 'd')
is_success(desc, res)
r2r1_id = get_id(res)

desc = "### test that resource cannot be changed to free while oversubscribed ###"
res = r.update_resource(restricted_id1, "s", "s", "free")
is_failure(desc, res)

"""" ---login as non_admin--- """
r.session = non_admin_session

desc = '### confirm restricted1 w/ no permissions ###'
res = r.confirm_resource_reservation(restricted_id2, r2r1_id)
is_failure(desc, res)

desc = '### deny restricted resource w/ no permission ###'
res = r.deny_resource_reservation(restricted_id1, r2r1_id)
is_failure(desc, res)

desc = "### test that resource cannot be updated w/ no permissions ###"
res = r.update_resource(restricted_id1, "s", "s", "free")
res = r.create_resource("free", "free", "free", 2, 0, 1)
is_success(desc, res)
free_id = get_id(res)

desc = "### create 1 to 2 reservation ###"
res = r.create_reservation([free_id, resource_id1], get_time(1), get_time(2), "t", "d")
is_success(desc, res)
reservation_id1 = get_id(res)

desc = "### create 1 to 3 reservation #1 ###"
res = r.create_reservation([free_id, resource_id1], get_time(1), get_time(3), "t", "d")
is_success(desc, res)
reservation_id2 = get_id(res)

desc = "### Test that resource sharing level can be moved up and down ###"
res = r.update_resource(resource_id1, sharing_level=4)
is_success(desc, res)
res = r.update_resource(resource_id1, sharing_level=2)
is_success(desc, res)

desc = "### create 1 to 3 reservation on free ###"
res = r.create_reservation([free_id], get_time(1), get_time(3), "t", "d")
is_failure(desc, res)

desc = "### create a conflicitng on both free and restricted ###"
res = r.create_reservation([free_id, resource_id1], get_time(1), get_time(3), "t", "d")
is_success(desc, res)

desc = "### Test that cannot set resource to free when oversubscribed with unconfirmed rsrvts."
res = r.update_resource(resource_id1, resource_state="free")
is_failure(desc, res)
Exemple #3
0
desc =  '#### add view permission to the group for the resource with tags ####'
res = r.add_group_permission_to_resource(resource_id, [group_id], ['view'])
test_print(desc, res.status_code < 300)

desc =  '#### get permissions for resource with tags and make sure we good ####'
res = r.get_group_permission_to_resource(resource_id)
test_print(desc, res.status_code < 300)
test_print(desc, r.json.loads(res.content)['results'][1]['group_id'] == group_id)

desc =  '#### add view permission to the group for the resource without tags ####'
res = r.add_group_permission_to_resource(no_tags_id, [group_id], ['view'])
test_print(desc, res.status_code < 300)

desc =  '#### update resource with tags ####'
res = r.update_resource(resource_id, "serverEdited", "huh edited")
test_print(desc, res.status_code < 300)

desc =  '#### get updated resource ####'
res = r.get_resource_by_id(resource_id)
test_print(desc, res.status_code < 300)
test_print(desc, r.json.loads(res.content)['results']['name'] == "serverEdited")

millis = int(round(time.time() * 1000)) + 86400000
millis2 = int(round(time.time() * 1000)) + 2*86400000
millis3 = int(round(time.time() * 1000)) + 3*86400000
millis4 = int(round(time.time() * 1000)) + 4*86400000

desc =  '#### create reservation ####'
res = r.create_reservation([restricted_id, resource_id], millis, millis2, 'title', 'description')
test_print(desc, res.status_code < 300)