Esempio n. 1
0
def test_start_game():
    create_test_game()
    room = get_room(TEST_GAME)
    assert room.game_round == 0
    assert room.game_mode == GameModes.LOBBY

    start_game_action.start_game(TEST_GAME)
    room = get_room(TEST_GAME)
    assert room.game_round == 1
    assert room.game_mode == GameModes.TURN_RECAP
Esempio n. 2
0
def test_next_mode_typical_case():
    clear_rooms()
    create_test_game()
    start_game_action.start_game(TEST_GAME)  # go to turn recap
    room = get_room(TEST_GAME)

    assert room.game_mode == GameModes.TURN_RECAP
    next_mode(room.name)
    room = get_room(TEST_GAME)
    assert room.game_mode == GameModes.CLUE_GIVING

    next_mode(room.name)
    room = get_room(TEST_GAME)
    assert room.game_mode == GameModes.TURN_RECAP
Esempio n. 3
0
def test_next_clue_giver_other_team_missing():
    clear_rooms()
    create_test_game()
    start_game_action.start_game(TEST_GAME)
    room = get_room(TEST_GAME)

    assert room.clue_giver == room.team_1_players[0]
    assert room.last_clue_giver is None
    giver = room.clue_giver

    # remove players from team 2
    update_room(room.name, evolve(room, team_2_players=[]))

    next_clue_giver(room.name)

    # next player now on same team as before
    room = get_room(TEST_GAME)
    assert room.clue_giver == room.team_1_players[1]
    assert room.last_clue_giver == giver
Esempio n. 4
0
def test_next_clue_giver_typical_case():
    clear_rooms()
    create_test_game()
    start_game_action.start_game(TEST_GAME)
    room = get_room(TEST_GAME)

    assert room.clue_giver == room.team_1_players[0]
    assert room.last_clue_giver is None
    giver = room.clue_giver

    next_clue_giver(room.name)

    room = get_room(TEST_GAME)
    assert room.clue_giver == room.team_2_players[0]
    assert room.last_clue_giver == giver
    giver = room.clue_giver

    next_clue_giver(room.name)

    room = get_room(TEST_GAME)
    assert room.clue_giver == room.team_1_players[1]
    assert room.last_clue_giver == giver
Esempio n. 5
0
def start_game(start_request: Dict[str, Any]):
    room_name = start_request[ROOM_NAME]
    start_game_action.start_game(room_name)
    force_room_update_action.force_room_update(room_name)