コード例 #1
0
def test_get_list_of_user_in_albums():
    rq_album.delete_all(token=env.env_var['USER_1_TOKEN'],
                        user_id=env.env_var['USER_1_MAIL'])
    data = {"name": "ablum test user", "description": "desc test album user"}
    new_album = rq_album.create(token=env.env_var['USER_1_TOKEN'], data=data)
    env.env_var['ALBUM_ID_SHARED'] = new_album["album_id"]

    rq_album.get_list_of_user(env.env_var['USER_1_TOKEN'],
                              env.env_var['ALBUM_ID_SHARED'],
                              count=1)
    rq_album.add_user(token=env.env_var.get("USER_1_TOKEN"),
                      album_id=env.env_var['ALBUM_ID_SHARED'],
                      user_id=env.env_var.get("USER_2_MAIL"))
    rq_album.get_list_of_user(env.env_var['USER_1_TOKEN'],
                              env.env_var['ALBUM_ID_SHARED'],
                              count=2)
    rq_album.add_user(token=env.env_var.get("USER_1_TOKEN"),
                      album_id=env.env_var['ALBUM_ID_SHARED'],
                      user_id=env.env_var.get("USER_3_MAIL"))
    rq_album.get_list_of_user(env.env_var['USER_1_TOKEN'],
                              env.env_var['ALBUM_ID_SHARED'],
                              count=3)
    user_in_album = rq_album.get_list_of_user(env.env_var["USER_1_TOKEN"],
                                              env.env_var['ALBUM_ID_SHARED'],
                                              3)

    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"]
    #verif admin ou non
    assert user_in_album[0]["is_admin"] == False
    assert user_in_album[1]["is_admin"] == True
    assert user_in_album[2]["is_admin"] == False
コード例 #2
0
def test_remove_favorite_with_not_user_member():
    rq_album.remove_favorite(env.env_var.get("USER_2_TOKEN"),
                             env.env_var["ALBUM_ID_1"],
                             status_code=404)
    #remove all created albums
    rq_album.delete_all(token=env.env_var['USER_1_TOKEN'],
                        user_id=env.env_var['USER_1_MAIL'])
    rq_album.delete_all(token=env.env_var['USER_2_TOKEN'],
                        user_id=env.env_var['USER_2_MAIL'])
コード例 #3
0
def test_add_album_to_favorites():
    rq_album.delete_all(token=env.env_var['USER_1_TOKEN'],
                        user_id=env.env_var['USER_1_MAIL'])
    album = rq_album.create(token=env.env_var['USER_1_TOKEN'],
                            data={"name": "new album favorite"})
    env.env_var["ALBUM_ID_1"] = album["album_id"]
    rq_album.add_favorite(env.env_var.get("USER_1_TOKEN"),
                          env.env_var["ALBUM_ID_1"])
    list_albums = rq_album.get_list(token=env.env_var.get("USER_1_TOKEN"),
                                    params={},
                                    count=1)
    assert list_albums[0]["album_id"] == env.env_var['ALBUM_ID_1']
    assert list_albums[0]['is_favorite'] == True
コード例 #4
0
def test_get_albums_empty_list():
    #Test with user 1
    rq_album.delete_all(token=env.env_var['USER_1_TOKEN'],
                        user_id=env.env_var['USER_1_MAIL'])
    list_albums = rq_album.get_list(token=env.env_var.get("USER_1_TOKEN"),
                                    count=0)
    assert len(list_albums) == 0
    #Test with user 2
    rq_album.delete_all(token=env.env_var['USER_2_TOKEN'],
                        user_id=env.env_var['USER_2_MAIL'])
    list_albums = rq_album.get_list(token=env.env_var.get("USER_2_TOKEN"),
                                    count=0)
    assert len(list_albums) == 0
コード例 #5
0
def test_clean_kheops():
    rq_album.delete_all(token=env.env_var['USER_1_TOKEN'], user_id=env.env_var['USER_1_MAIL'])
    rq_album.delete_all(token=env.env_var['USER_2_TOKEN'], user_id=env.env_var['USER_2_MAIL'])
    rq_album.delete_all(token=env.env_var['USER_3_TOKEN'], user_id=env.env_var['USER_3_MAIL'])
    rq_album.delete_all(token=env.env_var['USER_KARNAK_TOKEN'], user_id=env.env_var['USER_KARNAK_MAIL'])

    rq_studies.delete_all_from_inbox(token=env.env_var['USER_1_TOKEN'])
    rq_studies.delete_all_from_inbox(token=env.env_var['USER_2_TOKEN'])
    rq_studies.delete_all_from_inbox(token=env.env_var['USER_3_TOKEN'])
    rq_studies.delete_all_from_inbox(token=env.env_var['USER_KARNAK_TOKEN'])
コード例 #6
0
def test_delete_all_album():
    rq_album.delete_all(token=env.env_var['USER_1_TOKEN'],
                        user_id=env.env_var['USER_1_MAIL'])
    rq_album.delete_all(token=env.env_var['USER_2_TOKEN'],
                        user_id=env.env_var['USER_2_MAIL'])
    rq_album.delete_all(token=env.env_var['USER_3_TOKEN'],
                        user_id=env.env_var['USER_3_MAIL'])
コード例 #7
0
def test_create_new_album():
    rq_album.delete_all(token=env.env_var['USER_2_TOKEN'], user_id=env.env_var['USER_2_MAIL'])
    rq_album.delete_all(token=env.env_var['USER_1_TOKEN'], user_id=env.env_var['USER_1_MAIL'])
    rq_album.delete_all(token=env.env_var['USER_3_TOKEN'], user_id=env.env_var['USER_3_MAIL'])

    new_album = rq_album.create(token=env.env_var['USER_1_TOKEN'])
    env.env_var["ALBUM_ID_SOURCE"]=new_album["album_id"]
コード例 #8
0
def test_get_events_mutation_when_create_album():
    rq_album.delete_all(token=env.env_var['USER_1_TOKEN'],
                        user_id=env.env_var['USER_1_MAIL'])
    rq_album.delete_all(token=env.env_var['USER_2_TOKEN'],
                        user_id=env.env_var['USER_2_MAIL'])
    rq_album.delete_all(token=env.env_var['USER_3_TOKEN'],
                        user_id=env.env_var['USER_3_MAIL'])

    data = {
        "name": "ablum test comment",
        "description": "desc test album comment"
    }
    new_album = rq_album.create(token=env.env_var['USER_1_TOKEN'], data=data)
    env.env_var["ALBUM_ID_COMMENT"] = new_album["album_id"]
    events_list = rq_album.get_events(env.env_var["USER_1_TOKEN"],
                                      env.env_var['ALBUM_ID_COMMENT'],
                                      count=1,
                                      status_code=200)
    print(events_list)
    assert events_list[0]["event_type"] == "Mutation"
    assert events_list[0]["mutation_type"] == "CREATE_ALBUM"
    assert events_list[0]["source"]["email"] == env.env_var["USER_1_MAIL"]
    assert events_list[0]["source"]["can_access"] == True
コード例 #9
0
def test_delete_albums():
    #delete use 1 albums
    rq_album.delete_all(token=env.env_var['USER_2_TOKEN'], user_id=env.env_var['USER_2_MAIL'])
    rq_album.delete_all(token=env.env_var['USER_1_TOKEN'], user_id=env.env_var['USER_1_MAIL'])