def test_prediction_serializers(self): user = UserFactory() game = GameFactory() prediction = PredictionFactory(user=user, game=game) expected = { "game": game.id, "id": prediction.id, "scores": list(prediction.scores.all()), "user": user.id, } serializer = PredictionSerializer(prediction) assert serializer.data == expected
def test_Game_game_serializers(self): game = GameFactory() expected = { "date": game.date.isoformat() + "Z", "matches": list(game.matches.all()), "number_of_matches": game.number_of_matches, "players": list(game.players.all()), "score": "0:0", "slug": game.slug, "tournament": TournamentSerializerSmall(game.tournament).data, "winner": game.winner, } serializer = GameSerializer(game) assert serializer.data == expected