Пример #1
0
def test_join_lobby_9_3():
    token = logIn.getToken_Iatoy()
    response = client.post("/lobby/3/",
                           headers={"Authorization": token},
                           json={})
    assert response.status_code == 202
    assert response.json()["joinLobby_name"] == "lobby_WO_Max_players"
Пример #2
0
def test_leave_lobby():
    token = logIn.getToken_Iatoy()
    response = client.delete("/lobby/1",
                             headers={"Authorization": token},
                             json={})
    assert response.status_code == 202
    assert response.json()["responseText"] == " You left lobby 1"
Пример #3
0
def test_leave_lobby_UNL():
    token = logIn.getToken_Iatoy()
    response = client.delete("/lobby/2",
                             headers={"Authorization": token},
                             json={})
    assert response.status_code == 409
    assert response.json()["detail"] == " You are not in the provided lobby"
Пример #4
0
def test_leave_lobby_DNE():
    token = logIn.getToken_Iatoy()
    response = client.delete("/lobby/0",
                             headers={"Authorization": token},
                             json={})
    assert response.status_code == 409
    assert response.json(
    )["detail"] == " The lobby you selected does not exist"
Пример #5
0
def test_change_nick_lobby_NIL():
    token = logIn.getToken_Iatoy()
    new_nick = "1xxx"
    response = client.post("/lobby/2/change_nick",
                           headers={"Authorization": token},
                           json={"nick": new_nick})
    assert response.status_code == 412
    assert response.json(
    )["detail"] == " You are not in the lobby you selected (2)"
Пример #6
0
def test_change_nick_Max():
    token = logIn.getToken_Iatoy()
    new_nick = "1xxxxxxxxxxxxxxxxxxxxxx"
    response = client.post("/lobby/1/change_nick",
                           headers={"Authorization": token},
                           json={"nick": new_nick})
    assert response.status_code == 412
    assert response.json(
    )["detail"] == " Your Nick must have between 4 and 20 characters"
Пример #7
0
def test_change_nick_points():
    token = logIn.getToken_Iatoy()
    new_nick = "9xxx"
    response = client.post("/lobby/1/change_nick",
                           headers={"Authorization": token},
                           json={"nick": new_nick})
    assert response.status_code == 412
    assert response.json(
    )["detail"] == " You changed your nick too many times >:C"
Пример #8
0
def test_change_nick_10():
    token = logIn.getToken_Iatoy()
    new_nick = "10xx"
    puntos = 0
    response = client.post("/lobby/1/change_nick",
                           headers={"Authorization": token},
                           json={"nick": new_nick})
    assert response.status_code == 202
    assert response.json()["responseText"] == (
        f" Your nick has been sucessfully changed to {new_nick}, you can change it {puntos} more times"
    )