Пример #1
0
    def test_submissions_permissions(self):
        submission = TestRunProgramSubmission.objects.get(pk=1)
        kwargs = {
            'contest_id': submission.problem_instance.contest.id,
            'submission_id': submission.id,
        }

        self.assertTrue(self.client.login(username='******'))
        for view in [
                'get_testrun_output',
                'get_testrun_input',
                'download_testrun_output',
                'download_testrun_input',
        ]:
            check_not_accessible(self, view, kwargs=kwargs)

        for view in ['get_testrun_output', 'get_testrun_input']:
            check_ajax_not_accessible(self, view, kwargs=kwargs)

        contest = Contest.objects.get(pk='c')
        contest.controller_name = 'oioioi.contests.tests.PrivateContestController'
        contest.save()
        self.client.logout()
        for view in ['get_testrun_output', 'get_testrun_input']:
            check_ajax_not_accessible(self, view, kwargs=kwargs)
Пример #2
0
    def test_submissions_permissions(self):
        submission = TestRunProgramSubmission.objects.get(pk=1)
        kwargs = {'contest_id': submission.problem_instance.contest.id,
                'submission_id': submission.id}

        self.assertTrue(self.client.login(username='******'))
        for view in ['get_testrun_output', 'get_testrun_input',
                        'download_testrun_output', 'download_testrun_input']:
            check_not_accessible(self, view, kwargs=kwargs)

        for view in ['get_testrun_output', 'get_testrun_input']:
            check_ajax_not_accessible(self, view, kwargs=kwargs)

        contest = Contest.objects.get(pk='c')
        contest.controller_name = \
                'oioioi.contests.tests.PrivateContestController'
        contest.save()
        self.client.logout()
        for view in ['get_testrun_output', 'get_testrun_input']:
            check_ajax_not_accessible(self, view, kwargs=kwargs)