Exemplo n.º 1
0
 def test_make_team_dict(self):
     t = MagicMock()
     t.name = 'Red'
     t.players = [self._make_lobby_player()]
     p_dict = {
         'id': 0,
         'name': 'Name',
         'steam_id': '0',
     }
     t_info = {
         'id': 0,
         'name': 'Red',
         'players': [{
             'class_id': 0,
             'ready': True,
             'player': p_dict,
         }]
     }
     from lobbypy.models.utils import make_team_dict
     rv = make_team_dict(0, t)
     self.assertEqual(rv, t_info)
Exemplo n.º 2
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)
     return jsonify(200, team = make_team_dict(team_id, lobby.teams[team_id]))
Exemplo n.º 3
0
 def get(self, lobby_id):
     lobby = Lobby.query.get_or_404(lobby_id)
     team_dicts = [make_team_dict(i, t) for i, t in enumerate(lobby.teams)]
     return jsonify(200, teams = team_dicts)