def test_admin_userpermission_change_5(): reset_users() admin_dict1 = auth_register("*****@*****.**", "password", "admin", "privileges") admin_token = admin_dict1['token'] admin_id = admin_dict1['u_id'] admin_userpermission_change(admin_token, admin_id, 1) assert get_permission_id(admin_id) == 1
def test_admin_userpermission_change_3(): reset_users() admin_dict1 = auth_register("*****@*****.**", "password", "admin", "privileges") admin_token = admin_dict1['token'] admin_id = admin_dict1['u_id'] with pytest.raises(ValueError): admin_userpermission_change(admin_token, admin_id, -30)
def test_channel_join_11(): owner_token, owner_id, u_token, u_id = setup() channel = channels_create(owner_token, "Private Channel", "false") channel_id = channel['channel_id'] admin_userpermission_change(owner_token, u_id, 2) channel_join(u_token, channel_id) assert(channels_list(u_token) == { 'channels': [ {'channel_id': channel_id, 'name': "Private Channel"} ] })
def test_admin_userpermission_change_4(): reset_users() admin_dict1 = auth_register("*****@*****.**", "password", "admin", "privileges") admin_token = admin_dict1['token'] admin_id = admin_dict1['u_id'] member_dict1 = auth_register("*****@*****.**", "password", "member", "privileges") member_token = member_dict1['token'] member_id = member_dict1['u_id'] with pytest.raises(AccessError): admin_userpermission_change(member_token, member_id, 3)
def test_admin_userpermission_change_7(): reset_users() admin_dict1 = auth_register("*****@*****.**", "password", "admin", "privileges") admin_token = admin_dict1['token'] admin_id = admin_dict1['u_id'] member_dict1 = auth_register("*****@*****.**", "password", "member", "privileges") member_token = member_dict1['token'] member_id = member_dict1['u_id'] #admin changes member to owner (permission_id 3 --> 2) admin_userpermission_change(admin_token, member_id, 2) owner_token = member_token owner_id = member_id #owner tries to change admin's permission (LOL) with pytest.raises(AccessError): admin_userpermission_change(owner_token, admin_id, 2)
def test_channel_join_13(): owner_token, owner_id, u_token, u_id = setup() channel1 = channels_create(owner_token, "Channel Name", "true") channel2 = channels_create(owner_token, "Second Channel", "true") channel3 = channels_create(owner_token, "Third Channel", "true") channel4 = channels_create(owner_token, "Private1", "false") channel5 = channels_create(owner_token, "Private2", "false") channel6 = channels_create(owner_token, "Private3", "false") channel_id2 = channel2['channel_id'] channel_id3 = channel3['channel_id'] channel_id5 = channel5['channel_id'] admin_userpermission_change(owner_token, u_id, 2) channel_join(u_token, channel_id2) channel_join(u_token, channel_id3) channel_join(u_token, channel_id5) assert(channels_list(u_token) == { 'channels': [ {'channel_id': channel_id2, 'name': "Second Channel"}, {'channel_id': channel_id3, 'name': "Third Channel"}, {'channel_id': channel_id5, 'name': "Private2"} ] })