示例#1
0
def test_prostitute_prevents_seer(mock_roles, db_session):
    game = WurwolvesGame("test_game")

    wolf_id = uuid()
    seer_id = uuid()
    prostitute_id = uuid()
    villager_id = uuid()

    game.join(wolf_id)
    game.join(seer_id)
    game.join(prostitute_id)
    game.join(villager_id)
    game.join(uuid())
    game.join(uuid())

    game.start_game()

    # Seer checks villager but prostitute sleeps with seer.
    # Wolf kills villager, so villager dies
    game.prostitute_night_action(prostitute_id, seer_id)
    game.seer_night_action(seer_id, villager_id)
    game.wolf_night_action(wolf_id, villager_id)

    assert game.get_player_model(villager_id).state == PlayerState.WOLFED

    summary = get_summary_of_chat(game, seer_id)

    assert re.search(r"you couldn't concentrate", summary)
示例#2
0
def test_prostitute_not_choose_self(mock_roles, db_session):
    game = WurwolvesGame("test_game")

    wolf_id = uuid()
    medic_id = uuid()
    prostitute_id = uuid()
    villager_id = uuid()

    game.join(wolf_id)
    game.join(medic_id)
    game.join(prostitute_id)
    game.join(villager_id)
    game.join(uuid())
    game.join(uuid())

    game.start_game()

    # Check that the pristitute can't sleep with themselves
    with pytest.raises(HTTPException):
        game.prostitute_night_action(prostitute_id, prostitute_id)
示例#3
0
def test_prostitute_saves_villager(mock_roles, db_session):
    game = WurwolvesGame("test_game")

    wolf_id = uuid()
    prostitute_id = uuid()
    villager_id = uuid()

    game.join(wolf_id)
    game.join(prostitute_id)
    game.join(villager_id)
    game.join(uuid())
    game.join(uuid())
    game.join(uuid())

    game.start_game()

    # Prostitute sleep with villager, wolf attacks villager.
    # Villager isn't home, so doesn't die
    game.prostitute_night_action(prostitute_id, villager_id)
    game.wolf_night_action(wolf_id, villager_id)

    assert game.get_player_model(villager_id).state == PlayerState.ALIVE
示例#4
0
def test_prostitute_dooms_villager(mock_roles, db_session):
    game = WurwolvesGame("test_game")

    wolf_id = uuid()
    prostitute_id = uuid()
    villager_id = uuid()

    game.join(wolf_id)
    game.join(prostitute_id)
    game.join(villager_id)
    game.join(uuid())
    game.join(uuid())
    game.join(uuid())

    game.start_game()

    # Prostitute sleeps with villager, wolf attacks prostitute.
    # Both die.
    game.prostitute_night_action(prostitute_id, villager_id)
    game.wolf_night_action(wolf_id, prostitute_id)

    assert game.get_player_model(villager_id).state == PlayerState.WOLFED
    assert game.get_player_model(prostitute_id).state == PlayerState.WOLFED
示例#5
0
def test_prostitute_prevents_only_one_wolf_alt(mock_roles, db_session):
    game = WurwolvesGame("test_game")

    wolf_1_id = uuid()
    wolf_2_id = uuid()
    prostitute_id = uuid()
    villager_id = uuid()

    game.join(wolf_1_id)
    game.join(wolf_2_id)
    game.join(prostitute_id)
    game.join(villager_id)
    game.join(uuid())
    game.join(uuid())
    game.join(uuid())

    game.start_game()

    # Prostitute sleep with wolf 1, wolves attack villager.
    # First wolf if disabled but second wolf kills
    game.prostitute_night_action(prostitute_id, wolf_1_id)
    game.wolf_night_action(wolf_2_id, villager_id)

    assert game.get_player_model(villager_id).state == PlayerState.WOLFED
示例#6
0
def test_prostitute_prevents_medic(mock_roles, db_session):
    game = WurwolvesGame("test_game")

    wolf_id = uuid()
    medic_id = uuid()
    prostitute_id = uuid()
    villager_id = uuid()

    game.join(wolf_id)
    game.join(medic_id)
    game.join(prostitute_id)
    game.join(villager_id)
    game.join(uuid())
    game.join(uuid())

    game.start_game()

    # Medic saves villager but prostitute sleeps with medic.
    # Wolf kills villager, so villager dies
    game.prostitute_night_action(prostitute_id, medic_id)
    game.medic_night_action(medic_id, villager_id)
    game.wolf_night_action(wolf_id, villager_id)

    assert game.get_player_model(villager_id).state == PlayerState.WOLFED