コード例 #1
0
test_print(desc, res.status_code < 300)

desc =  '#### get all reservations on resources, make sure there are only 9 rows after update to view - rahuls reservations on res1 should be gone, ashwins shouldnt ####'
res = r.get_reservations_by_resources([resource_id1, resource_id2, resource_id3, resource_id4])
test_print(desc, len(r.json.loads(res.content)['results']) == 9)

desc =  '#### remove permission for group2 on resource1 ####'
res = r.remove_group_permission_to_resource(resource_id1, [group_id2])
test_print(desc, res.status_code < 300)

desc =  '#### get all reservations on resources, make sure there are only 6 rows remove permission - ashwins reservations on res1 should now be gone too ####'
res = r.get_reservations_by_resources([resource_id1, resource_id2, resource_id3, resource_id4])
test_print(desc, len(r.json.loads(res.content)['results']) == 6)

desc =  '#### remove rahul and ashwin from group1 ####'
res = r.remove_users_from_group([rahul_user_id, ashwin_user_id], group_id1)
test_print(desc, res.status_code < 300)

desc =  '#### get all reservations on resources, make sure there are only 3 rows after removal of rahul - rahuls reservations should be gone ####'
res = r.get_reservations_by_resources([resource_id1, resource_id2, resource_id3, resource_id4])
test_print(desc, len(r.json.loads(res.content)['results']) == 3)

desc =  '#### delete group2 ####'
res = r.delete_group(group_id2)
test_print(desc, res.status_code < 300)

desc =  '#### get all reservations on resources, make sure there are only no rows left ####'
res = r.get_reservations_by_resources([resource_id1, resource_id2, resource_id3, resource_id4])
test_print(desc, len(r.json.loads(res.content)['results']) == 0)

r.finish_test("remove permissions test")
コード例 #2
0
ファイル: tester.py プロジェクト: sdh31/ResourceTracker
desc =  '#### get reservations and check reservation has been deleted successfully ####'
res = r.get_reservations(resource_id, 0, 99999)
test_print(desc, len(r.json.loads(res.content)['results']) == 1)

desc =  '#### remove view permission to the group for the resource with tags ####'
res = r.remove_group_permission_to_resource(resource_id, [group_id])
test_print(desc, res.status_code < 300)

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

desc =  '#### remove the admin and rahul user from the group ####'
res = r.remove_users_from_group([1, user_id], group_id)
test_print(desc, res.status_code < 300)

desc =  '#### make sure that the users have been successfully removed ####'
res = r.get_users_in_group(group_id)
test_print(desc, len(r.json.loads(res.content)['results']) == 0)

desc =  '#### delete the group ####'
res = r.delete_group(group_id)
test_print(desc, res.status_code < 300)

desc =  '#### get groups and make sure the group was deleted ####'
res = r.get_groups()
test_print(desc, len(r.json.loads(res.content)['results']) == 2)

desc =  '#### update admin user to have new email ####'