Exemple #1
0
    def game(self):
        platform = Platform()
        video_game = Video()
        sound_game = Soundtrack()
        award_game = Award()
        developer = Developer()
        information_game = Information()

        game = GameFactory()
        ImageFactory(game=game)
        package_game = PackageFactory.build(game=game)

        platform.name = 'Ubuntu'
        platform.extensions = EXTENSION_CHOICES[0][0]
        platform.icon = 'Platform/linux.png'
        platform.save()

        package_game.save()
        package_game.platforms.add(platform)

        video_game.video = 'videos/exemplo.mp4'
        video_game.role = ROLE_CHOICES[0][0]
        video_game.game_id = game.id
        video_game.save()

        sound_game.soundtrack = 'soundtrack/exemplo.mp3'
        sound_game.role = ROLE_CHOICES[0][0]
        sound_game.game_id = game.id
        sound_game.save()

        award_game.name = 'Game of the year'
        award_game.year = 2014
        award_game.place = 'Conference game'
        award_game.save()

        developer.name = 'Developer 1'
        developer.login = '******'
        developer.github_page = 'https://github.com/PlataformaJogosUnb/'
        developer.save()

        information_game.description = 'This is a test game used to test the\
        serializer of the model game.'
        information_game.launch_year = 2013
        information_game.semester = 1
        information_game.game = game
        information_game.save()
        information_game.developers.add(developer)
        information_game.awards.add(award_game)
        return game
    def game(self):
        credit = CreditFactory()
        award_game = AwardFactory()

        game = GameFactory()
        InformationFactory(game=game, awards=[award_game], credits=[credit])

        ImageFactory(game=game)
        PlatformFactory()
        PackageFactory(game=game)

        VideoFactory(game=game)
        SoundtrackFactory(game=game)

        return game