def test_remove_player(fill_players): with test_session_scope() as ts: assert reset_session_squad(session_id=API_SESSION_ID, dbsession=ts) assert add_session_player(12, API_SESSION_ID, ts) assert remove_session_player(12, API_SESSION_ID, ts) players = get_session_players(API_SESSION_ID, ts) assert len(players) == 0
def test_cant_add_same_player_twice(fill_players): with test_session_scope() as ts: assert reset_session_squad(session_id=API_SESSION_ID, dbsession=ts) assert add_session_player(33, API_SESSION_ID, ts) assert not add_session_player(33, API_SESSION_ID, ts) players = get_session_players(API_SESSION_ID, ts) assert len(players) == 1 assert players[0]["id"] == 33
def list_session_players(): """ List all players currently in this session's squad. """ player_list = get_session_players(session_id=get_session_id()) return create_response(player_list)