Ejemplo n.º 1
0
 def make_connection(player, connectivity):
     lc = LobbyConnection(loop)
     lc.protocol = mock.Mock()
     conn = GameConnection(loop=loop,
                           lobby_connection=lc,
                           player_service=player_service,
                           games=game_service)
     conn.player = player
     conn.game = game
     conn._transport = transport
     conn._connectivity_state.set_result(connectivity)
     return conn
Ejemplo n.º 2
0
 def make_connection(player, connectivity):
     lc = LobbyConnection(loop)
     lc.protocol = mock.Mock()
     conn = GameConnection(loop=loop,
                           lobby_connection=lc,
                           player_service=player_service,
                           games=game_service)
     conn.player = player
     conn.game = game
     conn._transport = transport
     conn._connectivity_state.set_result(connectivity)
     return conn
Ejemplo n.º 3
0
def game_connection(request, game, loop, player_service, players, game_service, transport):
    from server import GameConnection, LobbyConnection
    conn = GameConnection(loop=loop,
                          lobby_connection=mock.create_autospec(LobbyConnection(loop)),
                          player_service=player_service,
                          games=game_service)
    conn._transport = transport
    conn.player = players.hosting
    conn.game = game
    conn.lobby = mock.Mock(spec=LobbyConnection)

    def fin():
        conn.abort()

    request.addfinalizer(fin)
    return conn
Ejemplo n.º 4
0
def game_connection(request, game, loop, player_service, players, game_service,
                    transport):
    from server import GameConnection, LobbyConnection
    conn = GameConnection(loop=loop,
                          lobby_connection=mock.create_autospec(
                              LobbyConnection(loop)),
                          player_service=player_service,
                          games=game_service)
    conn._transport = transport
    conn.player = players.hosting
    conn.game = game
    conn.lobby = mock.Mock(spec=LobbyConnection)

    def fin():
        conn.abort()

    request.addfinalizer(fin)
    return conn