Пример #1
0
    def test_serialization_award(self):
        award = Award(name='Melhor Trilha Sonora', place='Segundo Lugar')

        award_serialized = AwardSerializer(award).data
        expected_json_award = {
            "name": 'Melhor Trilha Sonora',
            "place": 'Segundo Lugar'}
        assert award_serialized == expected_json_award
Пример #2
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
Пример #3
0
    def test_serialization_award(self, award_serial):
        award = Award(name='VGA', year='2017', place='UnB')

        award_serialized = AwardSerializer(award).data
        assert award_serial == award_serialized
Пример #4
0
 def test_name_validation(self, name, year, place, errors_dict):
     award = Award(name=name, place=place, year=year)
     validation_test(award, errors_dict)
Пример #5
0
 def test_place_validation(self, place, name, errors_dict):
     award = Award(name=name, place=place)
     validation_test(award, errors_dict)