Exemple #1
0
async def test_initialized_game_not_allowed_to_end(game: Game):
    await game.clear_data()
    game.state = GameState.INITIALIZING

    game.on_game_end()

    assert game.state is GameState.INITIALIZING
Exemple #2
0
async def test_initialized_game_not_allowed_to_end(game: Game):
    await game.clear_data()
    game.state = GameState.INITIALIZING

    game.on_game_end()

    assert game.state is GameState.INITIALIZING
Exemple #3
0
async def test_game_end_when_no_more_connections(game: Game, mock_game_connection):
    game.state = GameState.LOBBY

    game.on_game_end = CoroMock()
    mock_game_connection.state = GameConnectionState.CONNECTED_TO_HOST
    game.add_game_connection(mock_game_connection)
    await game.remove_game_connection(mock_game_connection)

    game.on_game_end.assert_any_call()
Exemple #4
0
async def test_game_end_when_no_more_connections(game: Game, mock_game_connection):
    game.state = GameState.LOBBY

    game.on_game_end = CoroMock()
    mock_game_connection.state = GameConnectionState.CONNECTED_TO_HOST
    game.add_game_connection(mock_game_connection)
    await game.remove_game_connection(mock_game_connection)

    game.on_game_end.assert_any_call()