def test_add_user_directly_admin_in_album(): #remove user rq_album.remove_user(env.env_var["USER_1_TOKEN"], env.env_var["ALBUM_ID_SHARED"], env.env_var["USER_2_MAIL"], status_code=204) user_in_album = rq_album.get_list_of_user(env.env_var["USER_1_TOKEN"], env.env_var['ALBUM_ID_SHARED'], count=2, status_code=200) assert user_in_album[0]["email"] == env.env_var["USER_3_MAIL"] assert user_in_album[1]["email"] == env.env_var["USER_1_MAIL"] assert user_in_album[0]["is_admin"] == False assert user_in_album[1]["is_admin"] == True rq_album.upgrade_user_to_admin(token=env.env_var["USER_1_TOKEN"], album_id=env.env_var["ALBUM_ID_SHARED"], user_id=env.env_var["USER_2_MAIL"], status_code=204) user_in_album = rq_album.get_list_of_user(env.env_var["USER_1_TOKEN"], env.env_var['ALBUM_ID_SHARED'], count=3, status_code=200) assert user_in_album[0]["email"] == env.env_var["USER_3_MAIL"] assert user_in_album[1]["email"] == env.env_var["USER_1_MAIL"] assert user_in_album[2]["email"] == env.env_var["USER_2_MAIL"] assert user_in_album[0]["is_admin"] == False assert user_in_album[1]["is_admin"] == True assert user_in_album[2]["is_admin"] == True
def test_that_all_user_quit_album(): rq_album.remove_user(env.env_var["USER_2_TOKEN"], env.env_var["ALBUM_ID_SHARED"], env.env_var["USER_2_MAIL"], status_code=204) rq_album.remove_user(env.env_var["USER_3_TOKEN"], env.env_var["ALBUM_ID_SHARED"], env.env_var["USER_3_MAIL"], status_code=204)
def test_mutation_admin_remove_user(): rq_album.remove_user(token=env.env_var["USER_1_TOKEN"], album_id=env.env_var['ALBUM_ID_MUTATION'], user_id=env.env_var.get("USER_2_MAIL")) events_list = rq_album.get_events(env.env_var["USER_1_TOKEN"], env.env_var['ALBUM_ID_MUTATION'], count=7, status_code=200) assert events_list[0]["event_type"] == "Mutation" assert events_list[0]["mutation_type"] == "REMOVE_USER" assert len(events_list) == 7
def test_remove_user_in_album(): album_id_shared = env.env_var.get("ALBUM_ID_1") album_shared_in_album = True rq_album.remove_user(token=env.env_var.get("USER_1_TOKEN"), album_id=album_id_shared, user_id=env.env_var.get("USER_2_MAIL")) list_albums_user2 = rq_album.get_list( token=env.env_var.get("USER_2_TOKEN"), count=1) #check that the album is no longer present in its list for album in list_albums_user2: if album['album_id'] == album_id_shared: album_shared_in_album = False assert album_shared_in_album
def test_remove_first_user_admin_in_album(): #remove user rq_album.remove_user(env.env_var["USER_1_TOKEN"], env.env_var["ALBUM_ID_SHARED"], env.env_var["USER_1_MAIL"], status_code=204) user_in_album = rq_album.get_list_of_user(env.env_var["USER_2_TOKEN"], env.env_var['ALBUM_ID_SHARED'], count=2, status_code=200) assert user_in_album[0]["email"] == env.env_var["USER_3_MAIL"] assert user_in_album[1]["email"] == env.env_var["USER_2_MAIL"] assert user_in_album[0]["is_admin"] == False assert user_in_album[1]["is_admin"] == True
def test_user2_leaves_album(): rq_album.remove_user(env.env_var.get("USER_2_TOKEN"), env.env_var['ALBUM_ID_1'], env.env_var.get("USER_2_MAIL")) #check user 1 albums list_albums = rq_album.get_list(token=env.env_var.get("USER_1_TOKEN"), params={}, count=2) assert list_albums[0]["album_id"] == env.env_var['ALBUM_ID_2'] assert list_albums[0]['is_favorite'] == False assert list_albums[1]["album_id"] == env.env_var['ALBUM_ID_1'] assert list_albums[1]['is_favorite'] == True #check user 2 albums rq_album.get_list(token=env.env_var.get("USER_2_TOKEN"), params={}, count=0)