Example #1
0
 def get(self, lobby_id, team_id):
     lobby = Lobby.query.get_or_404(lobby_id)
     if team_id >= len(lobby.teams) or team_id < 0:
         abort(404)
     players_dict = [make_lobby_player_dict(lp) for lp in
             lobby.teams[team_id].players]
     return jsonify(200, lobby_players = players_dict)
Example #2
0
 def get(self, lobby_id, team_id, player_id):
     lobby = Lobby.query.get_or_404(lobby_id)
     if team_id >= len(lobby.teams) or team_id < 0:
         abort(404)
     team = lobby.teams[team_id]
     player = Player.query.get_or_404(player_id)
     if not player in team:
         abort(404)
     return jsonify(200,
             lobby_player = make_lobby_player_dict(team.get_lobby_player(player)))
Example #3
0
 def test_make_lobby_player_dict(self):
     lp = MagicMock()
     lp.class_id = 0
     lp.ready = True
     lp.player = MagicMock()
     lp.player.id = 0
     lp.player.name = 'Name'
     lp.player.steam_id = '0'
     lp_info = {
         'class_id': 0,
         'ready': True,
         'player': {
             'id': 0,
             'name': 'Name',
             'steam_id': '0',
         },
     }
     from lobbypy.models.utils import make_lobby_player_dict
     rv = make_lobby_player_dict(lp)
     self.assertEqual(rv, lp_info)