コード例 #1
0
ファイル: tests.py プロジェクト: tmkkk/oioioi
def add_ex_conf(contest, start_date, end_date=None, enabled=True):
    ex_conf = ExclusivenessConfig()
    ex_conf.contest = contest
    ex_conf.start_date = start_date
    ex_conf.end_date = end_date
    ex_conf.enabled = enabled
    ex_conf.save()
    return ex_conf
コード例 #2
0
    def test_enabled_field(self):
        ex_conf = ExclusivenessConfig()
        ex_conf.contest = self.c2
        ex_conf.start_date = datetime(2012, 1, 1, 10, tzinfo=utc)
        ex_conf.end_date = datetime(2012, 1, 1, 14, tzinfo=utc)
        ex_conf.enabled = False
        ex_conf.save()

        with fake_time(datetime(2012, 1, 1, 11, tzinfo=utc)):
            self._assertContestVisible('c1')
            self._assertContestVisible('c2')

            ex_conf.enabled = True
            ex_conf.save()

            self._assertContestRedirects('c1', '/c/c2/')
            self._assertContestVisible('c2')
コード例 #3
0
ファイル: tests.py プロジェクト: sio2project/oioioi
def add_ex_conf(contest, start_date, end_date=None, enabled=True):
    ex_conf = ExclusivenessConfig()
    ex_conf.contest = contest
    ex_conf.start_date = start_date
    ex_conf.end_date = end_date
    ex_conf.enabled = enabled
    ex_conf.save()
    return ex_conf
コード例 #4
0
ファイル: tests.py プロジェクト: cytadela8/oioioi
    def test_exclusiveness_off(self):
        ex_conf = ExclusivenessConfig()
        ex_conf.contest = self.c
        ex_conf.start_date = datetime(2012, 1, 1, 10, tzinfo=utc)
        ex_conf.end_date = datetime(2012, 1, 1, 14, tzinfo=utc)
        ex_conf.enabled = False
        ex_conf.save()

        response = self.user.get(self.url, follow=True)
        self.assertEqual(response.status_code, 403)

        response = self.admin.get(self.url, follow=True)
        self.assertEqual(response.status_code, 200)
        self.assertIn('Exclusiveness configs', response.content)

        response = self.contestadmin.get(self.url, follow=True)
        self.assertEqual(response.status_code, 200)
        self.assertNotIn('Exclusiveness configs', response.content)
コード例 #5
0
    def test_exclusiveness_off(self):
        ex_conf = ExclusivenessConfig()
        ex_conf.contest = self.c
        ex_conf.start_date = datetime(2012, 1, 1, 10, tzinfo=utc)
        ex_conf.end_date = datetime(2012, 1, 1, 14, tzinfo=utc)
        ex_conf.enabled = False
        ex_conf.save()

        response = self.user.get(self.url, follow=True)
        self.assertEqual(response.status_code, 403)

        response = self.admin.get(self.url, follow=True)
        self.assertEqual(response.status_code, 200)
        self.assertIn('Exclusiveness configs', response.content)

        response = self.contestadmin.get(self.url, follow=True)
        self.assertEqual(response.status_code, 200)
        self.assertNotIn('Exclusiveness configs', response.content)