示例#1
0
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
示例#2
0
def test_that_the_user_not_admin_cannot_become_admin():
    rq_album.upgrade_user_to_admin(token=env.env_var["USER_2_TOKEN"],
                                   album_id=env.env_var["ALBUM_ID_SHARED"],
                                   user_id=env.env_var["USER_2_MAIL"],
                                   status_code=403)
    rq_album.upgrade_user_to_admin(token=env.env_var["USER_3_TOKEN"],
                                   album_id=env.env_var["ALBUM_ID_SHARED"],
                                   user_id=env.env_var["USER_2_MAIL"],
                                   status_code=403)
def test_mutation_upgrade_user_in_album():
    rq_album.upgrade_user_to_admin(env.env_var["USER_1_TOKEN"],
                                   env.env_var['ALBUM_ID_MUTATION'],
                                   env.env_var["USER_2_MAIL"],
                                   status_code=204)
    events_list = rq_album.get_events(env.env_var["USER_1_TOKEN"],
                                      env.env_var['ALBUM_ID_MUTATION'],
                                      count=6,
                                      status_code=200)
    assert events_list[0]["event_type"] == "Mutation"
    assert events_list[0]["mutation_type"] == "PROMOTE_ADMIN"
    assert len(events_list) == 6