Exemplo n.º 1
0
def make_user_contest_admin(user, contest):
    cp = ContestPermission()
    cp.user = user
    cp.permission = 'contests.contest_admin'
    cp.contest = contest
    cp.save()

    contest.refresh_from_db()
Exemplo n.º 2
0
def change_contest_type():
    c = Contest.objects.get(id='c')
    c.controller_name = \
        'oioioi.teachers.controllers.TeacherContestController'
    c.save()

    user = User.objects.get(username='******')
    cp = ContestPermission()
    cp.user = user
    cp.permission = 'contests.contest_admin'
    cp.contest = c
    cp.save()

    return c
Exemplo n.º 3
0
def change_contest_type():
    c = Contest.objects.get(id='c')
    c.controller_name = \
        'oioioi.teachers.controllers.TeacherContestController'
    c.save()

    user = User.objects.get(username='******')
    cp = ContestPermission()
    cp.user = user
    cp.permission = 'contests.contest_admin'
    cp.contest = c
    cp.save()

    return c
Exemplo n.º 4
0
    def login(self, get_problems):
        c = Contest.objects.get(id='c')
        c.controller_name = 'oioioi.teachers.controllers.TeacherContestController'
        c.save()

        user = User.objects.get(username='******')
        cp = ContestPermission()
        cp.user = user
        cp.permission = 'contests.contest_admin'
        cp.contest = c
        cp.save()

        self.assertTrue(self.client.login(username='******'))
        self.client.get('/c/c/')

        if get_problems:
            pi = ProblemInstance.objects.filter(contest=c)[0]
            p = pi.problem
            return (pi, p)
        return c
Exemplo n.º 5
0
    def login(self, get_problems):
        c = Contest.objects.get(id='c')
        c.controller_name = \
            'oioioi.teachers.controllers.TeacherContestController'
        c.save()

        user = User.objects.get(username='******')
        cp = ContestPermission()
        cp.user = user
        cp.permission = 'contests.contest_admin'
        cp.contest = c
        cp.save()

        self.assertTrue(self.client.login(username='******'))
        self.client.get('/c/c/')

        if get_problems:
            pi = ProblemInstance.objects.filter(contest=c)[0]
            p = pi.problem
            return (pi, p)
        return c
Exemplo n.º 6
0
    def test_teacher_dashboard_full(self):
        user = User.objects.get(username='******')
        for i in range(10):
            c = Contest()
            c.name = 'tmp' + str(i)
            c.controller_name = \
                'oioioi.teachers.controllers.TeacherContestController'
            c.id = 'tmp' + str(i)
            c.save()

            cp = ContestPermission()
            cp.user = user
            cp.permission = 'contests.contest_admin'
            cp.contest = c
            cp.save()

        self.assertTrue(self.client.login(username='******'))
        url = reverse('teacher_dashboard')
        response = self.client.get(url)

        self.assertEqual(response.status_code, 200)
        self.assertContains(response, 'Show all contests')
Exemplo n.º 7
0
    def test_user_dashboard_full(self):
        user = User.objects.get(username='******')
        for i in range(10):
            c = Contest()
            c.name = 'tmp' + str(i)
            c.controller_name = \
                'oioioi.teachers.controllers.TeacherContestController'
            c.id = 'tmp' + str(i)
            c.save()

            cp = ContestPermission()
            cp.user = user
            cp.permission = 'contests.contest_admin'
            cp.contest = c
            cp.save()

        self.assertTrue(self.client.login(username='******'))
        url = reverse('simpleui_user_dashboard')
        response = self.client.get(url)

        self.assertEqual(response.status_code, 200)
        self.assertContains(response, 'Show all contests')