def test_from_player(self): presenter = PlayerPresenter.from_player(self.player) self.assertEqual(presenter.username, self.user.username) self.assertEqual(presenter.win_count, 1) self.assertEqual(presenter.loss_count, 1) self.assertEqual(presenter.in_progress_count, 1)
def from_team(cls, team, game): return cls( player=PlayerPresenter.from_player(team.player), is_next=is_team_next(team, game), winner=team.winner, alive=team.alive, tiles=cls.make_tiles(team, game) )
def get(self, request, username, *args, **kwargs): try: user = User.objects.get(username=username) except User.DoesNotExist: raise Http404("Member does not exist") player = Player.objects.get(user=user) context = { 'player': PlayerPresenter.from_player(player), } return render(request, self.template_name, context)
def from_team(cls, team, game): return cls(player=PlayerPresenter.from_player(team.player), is_next=is_team_next(team, game), winner=team.winner, alive=team.alive, tiles=cls.make_tiles(team, game))