Пример #1
0
    def setUpClass(cls):
        super(TournamentTestCase, cls).setUpClass()

        Account.objects.create(id=37, battle_tag='ADMIN', account_id='99999')
        for i in range(0, cls.players):
            Account.objects.create_user(id_generator(),
                                        random.randint(100000, 999999))
        cls.new_tour = Tournament.create('All',
                                         'Semi',
                                         'Finals',
                                         fare=10,
                                         name='Name',
                                         maxplayers=12,
                                         rules='Rules',
                                         date='2015-01-01',
                                         format='SE',
                                         time='15:00',
                                         account=Account.objects.last(),
                                         background='',
                                         region='Europe')
        cls.client = APIClient()

        accounts = Account.objects.all()
        for acc in accounts:
            new_attendant = Attendant(account=acc,
                                      tournament=cls.new_tour,
                                      gameClass='rus.png')
            new_attendant.save()
Пример #2
0
    def setUpClass(cls):
        super(TournamentTestCase, cls).setUpClass()

        Account.objects.create(id=37, battle_tag='ADMIN', account_id='99999')
        for i in range(0, cls.players):
            Account.objects.create_user(id_generator(), random.randint(100000, 999999))
        cls.new_tour = Tournament.create('All', 'Semi', 'Finals', fare=10, name='Name', maxplayers=12, rules='Rules',
                                         date='2015-01-01', format='SE',
                                         time='15:00', account=Account.objects.last(), background='', region='Europe')
        cls.client = APIClient()

        accounts = Account.objects.all()
        for acc in accounts:
            new_attendant = Attendant(account=acc, tournament=cls.new_tour, gameClass='rus.png')
            new_attendant.save()
Пример #3
0
 def create(self, validated_data):
     flag = self.context['request'].user.flag
     tournament = Tournament.objects.get(id=validated_data['tournament_id'])
     new_attendant = Attendant(account=self.context['request'].user, tournament=tournament, gameClass=flag)
     new_attendant.save()
     return new_attendant