Beispiel #1
0
async def test_game_visible_for_rating(game: Game, players):
    game.enforce_rating_range = True
    game.displayed_rating_range = InclusiveRange(2000, None)
    game.host = players.hosting

    players.joining.ratings[RatingType.GLOBAL] = (1500, 1)
    assert not game.is_visible_to_player(players.joining)

    players.joining.ratings[RatingType.GLOBAL] = (2100, 1)
    assert game.is_visible_to_player(players.joining)
Beispiel #2
0
async def test_game_visible_to_friends(game: Game, players):
    game.host = players.hosting
    game.visibility = VisibilityState.FRIENDS
    players.hosting.friends.add(players.joining.id)
    assert game.is_visible_to_player(players.joining)
Beispiel #3
0
async def test_game_visible_to_players(game: Game, players):
    game.host = players.hosting
    game.visibility = None  # Ensure that visibility is not checked
    game.state = GameState.LOBBY
    add_connected_player(game, players.joining)
    assert game.is_visible_to_player(players.joining)
Beispiel #4
0
async def test_game_not_visible_to_foes(game: Game, players):
    game.host = players.hosting
    players.hosting.foes.add(players.joining.id)
    assert not game.is_visible_to_player(players.joining)
Beispiel #5
0
async def test_game_visible_to_host(game: Game, players):
    game.host = players.hosting
    game.visibility = None  # Ensure that visibility is not checked
    assert game.is_visible_to_player(players.hosting)