def setUpTestData(self): super().setUpTestData() create_problem_type(name='type') self.basic_problem = create_problem( code='basic', allowed_languages=Language.objects.values_list('key', flat=True), types=('type',), authors=('normal',), testers=('staff_problem_edit_public',), ) limits = [] for lang in Language.objects.filter(common_name=Language.get_python3().common_name): limits.append( LanguageLimit( problem=self.basic_problem, language=lang, time_limit=100, memory_limit=131072, ), ) LanguageLimit.objects.bulk_create(limits) self.organization_private_problem = create_problem( code='organization_private', time_limit=2, is_public=True, is_organization_private=True, curators=('staff_problem_edit_own', 'staff_problem_edit_own_no_staff'), )
def setUpTestData(self): super().setUpTestData() self.users.update({ 'staff_solution_see_all': create_user( username='******', user_permissions=('see_private_solution',), ), }) _now = timezone.now() self.basic_solution = create_solution(problem='basic') self.private_solution = create_solution( problem='private', is_public=False, publish_on=_now - timezone.timedelta(days=100), ) self.unpublished_problem = create_problem( code='unpublished', name='Unpublished', authors=('staff_problem_edit_own',), ) self.unpublished_solution = create_solution( problem=self.unpublished_problem, is_public=False, publish_on=_now + timezone.timedelta(days=100), authors=('normal',), )
def setUpTestData(self): super().setUpTestData() self.users.update({ 'staff_submission_view_all': create_user( username='******', is_staff=True, user_permissions=('view_all_submission', ), ), }) self.basic_submission = Submission.objects.create( user=self.users['normal'].profile, problem=create_problem(code='basic'), language=Language.get_python3(), result='AC', status='D', case_points=99, case_total=100, memory=20, locked_after=None, ) self.full_ac_submission = Submission.objects.create( user=self.users['normal'].profile, problem=create_problem(code='full_ac'), language=Language.get_python3(), result='AC', status='D', case_points=1, case_total=1, ) self.full_ac_submission_source = SubmissionSource.objects.create( submission=self.full_ac_submission, source='', ) self.locked_submission = Submission.objects.create( user=self.users['normal'].profile, problem=create_problem(code='locked'), language=Language.get_python3(), result='WA', status='D', case_points=1, case_total=1, locked_after=timezone.now() - timezone.timedelta(days=100), ) self.future_locked_submission = Submission.objects.create( user=self.users['normal'].profile, problem=create_problem(code='future_locked'), language=Language.get_python3(), result='WA', status='D', case_points=1, case_total=1, locked_after=timezone.now() + timezone.timedelta(days=100), ) self.ie_submission = Submission.objects.create( user=self.users['superuser'].profile, problem=create_problem( code='ie', is_public=True, ), language=Language.get_python3(), result='IE', status='IE', memory=None, ) # jump down the rabbit hole to attach a contest submission problem = create_problem(code='queued') contest = create_contest(key='queued') self.queued_submission = Submission.objects.create( user=self.users['superuser'].profile, problem=problem, language=Language.get_python3(), contest_object=contest, case_points=50, case_total=100, ) self.queued_contest_submission = ContestSubmission.objects.create( submission=self.queued_submission, problem=create_contest_problem(problem=problem, contest=contest, partial=False), participation=create_contest_participation(contest=contest, user='******'), )