Esempio n. 1
0
def test_edit_album_with_new_admin_add_in_album():
    edit_name = "edit name"
    edit_desc = "edit desc"
    data = {
        "name": edit_name,
        "description": edit_desc,
        "sendSeries": True,
        "addUser": True,
        "deleteSeries": True,
        "notificationNewSeries": False,
        "notificationNewComment": False
    }
    rq_album.edit(token=env.env_var.get("USER_2_TOKEN"),
                  album_id=env.env_var['ALBUM_ID_SHARED'],
                  data=data,
                  status_code=200)
    edit_album = rq_album.get(env.env_var.get("USER_2_TOKEN"),
                              env.env_var['ALBUM_ID_SHARED'])
    assert edit_album["name"] == edit_name
    assert edit_album['description'] == edit_desc
    assert edit_album["add_user"] == True
    assert edit_album["download_series"] == True
    assert edit_album["send_series"] == True
    assert edit_album["delete_series"] == True
    assert edit_album["add_series"] == True
    assert edit_album["write_comments"] == True
    assert edit_album["notification_new_series"] == False
    assert edit_album["notification_new_comment"] == False
Esempio n. 2
0
def test_edit_album():
    edit_name = "edit name"
    edit_desc = "edit desc"
    data = {
        "name": edit_name,
        "description": edit_desc,
        "sendSeries": True,
        "addUser": True,
        "deleteSeries": True,
        "notificationNewSeries": False,
        "notificationNewComment": False
    }
    rq_album.edit(token=env.env_var.get("USER_1_TOKEN"),
                  album_id=env.env_var.get("ALBUM_ID_1"),
                  data=data)
    edit_album = rq_album.get(env.env_var.get("USER_1_TOKEN"),
                              env.env_var.get("ALBUM_ID_1"))
    assert edit_album["name"] == edit_name
    assert edit_album['description'] == edit_desc
    assert edit_album["add_user"] == True
    assert edit_album["download_series"] == True
    assert edit_album["send_series"] == True
    assert edit_album["delete_series"] == True
    assert edit_album["add_series"] == True
    assert edit_album["write_comments"] == True
    assert edit_album["notification_new_series"] == False
    assert edit_album["notification_new_comment"] == False

    #re edit
    edit_name = "re edit name"
    edit_desc = "re edit desc"
    data = {
        "name": edit_name,
        "description": edit_desc,
        "sendSeries": False,
        "addUser": False,
        "deleteSeries": True,
        "notificationNewSeries": True,
        "notificationNewComment": True
    }
    rq_album.edit(token=env.env_var.get("USER_1_TOKEN"),
                  album_id=env.env_var.get("ALBUM_ID_1"),
                  data=data)
    edit_album = rq_album.get(env.env_var.get("USER_1_TOKEN"),
                              env.env_var.get("ALBUM_ID_1"))
    assert edit_album["name"] == edit_name
    assert edit_album['description'] == edit_desc
    assert edit_album["add_user"] == False
    assert edit_album["download_series"] == True
    assert edit_album["send_series"] == False
    assert edit_album["delete_series"] == True
    assert edit_album["add_series"] == True
    assert edit_album["write_comments"] == True
    assert edit_album["notification_new_series"] == True
    assert edit_album["notification_new_comment"] == True
Esempio n. 3
0
def test_edit_album_forbidden_when_not_admin():
    data = {
        "name": "edit name",
        "description": "edit desc",
        "sendSeries": True,
        "addUser": True,
        "deleteSeries": True,
        "notificationNewSeries": False,
        "notificationNewComment": False
    }
    rq_album.edit(token=env.env_var.get("USER_3_TOKEN"),
                  album_id=env.env_var['ALBUM_ID_SHARED'],
                  data=data,
                  status_code=403)
Esempio n. 4
0
def test_edit_album_notif_and_more_forbidden():
    data = {
        "name": "edit name",
        "description": "edit desc",
        "addUser": True,
        "downloadSeries": False,
        "sendSeries": False,
        "deleteSeries": True,
        "addSeries": False,
        "writeComments": False,
        "notificationNewSeries": False,
        "notificationNewComment": False
    }
    rq_album.edit(token=env.env_var.get("USER_2_TOKEN"),
                  album_id=env.env_var.get("ALBUM_ID_1"),
                  data=data,
                  status_code=403)
def test_remove_user_permission_to_write_comment():
    data_edit = {
        "name": "album comment edit",
        "description": "edit album comment",
        "writeComments": False
    }
    rq_album.edit(env.env_var["USER_1_TOKEN"],
                  env.env_var["ALBUM_ID_COMMENT"],
                  data_edit,
                  status_code=200)
    events_list = rq_album.get_events(env.env_var["USER_1_TOKEN"],
                                      env.env_var['ALBUM_ID_COMMENT'],
                                      count=6,
                                      status_code=200)
    assert events_list[0]["mutation_type"] == "EDIT_ALBUM"
    rq_album.post_comment(env.env_var["USER_2_TOKEN"],
                          env.env_var['ALBUM_ID_COMMENT'],
                          data={"comment": "other user not have permission"},
                          status_code=403)
def test_edit_album_and_get_mutation():
    data_edit = {
        "name": "album comment edit",
        "description": "edit album comment",
        "sendSeries": True,
        "addUser": True,
        "deleteSeries": True,
        "notificationNewSeries": False,
        "notificationNewComment": False
    }
    rq_album.edit(env.env_var["USER_1_TOKEN"],
                  env.env_var["ALBUM_ID_COMMENT"],
                  data_edit,
                  status_code=200)
    events_list = rq_album.get_events(env.env_var["USER_1_TOKEN"],
                                      env.env_var['ALBUM_ID_COMMENT'],
                                      count=4,
                                      status_code=200)
    assert events_list[0]["mutation_type"] == "EDIT_ALBUM"
    assert events_list[1]["mutation_type"] == "ADD_USER"
    assert events_list[1]["source"]["email"] == env.env_var["USER_1_MAIL"]
    assert events_list[1]["target"]["email"] == env.env_var["USER_2_MAIL"]
    assert events_list[2]["comment"] == env.env_var["COMMENT_1"]
    assert events_list[3]["mutation_type"] == "CREATE_ALBUM"
Esempio n. 7
0
def test_edit_album_notif_ok():
    data = {"notificationNewSeries": False, "notificationNewComment": False}
    rq_album.edit(token=env.env_var.get("USER_2_TOKEN"),
                  album_id=env.env_var.get("ALBUM_ID_1"),
                  data=data)