def test_get_program_filter(self):
     context = AnalyzeJudgingContext(type="matching",
                                     name="program",
                                     read_count=1)
     count = 4
     options = ProgramFactory.create_batch(count, cycle=context.cycle)
     context.add_applications(context.scenario.panel_size * count,
                              programs=options)
     judge_option = options[0].program_family
     judge = ExpertFactory(profile__home_program_family=judge_option)
     context.add_judge(assigned=False, complete=False, judge=judge)
     field = "startup__startupprograminterest__program__program_family"
     apps = Application.objects.filter(**{
         field: judge_option
     }).values_list("id", flat=True)
     self.assert_matching_allocation(context.judging_round, judge, apps)
 def test_get_program_filter_multiple_startup_interests(self):
     context = AnalyzeJudgingContext(type="matching",
                                     name="program",
                                     read_count=1)
     count = 4
     options = ProgramFactory.create_batch(count, cycle=context.cycle)
     panel_size = context.scenario.panel_size
     context.add_applications(panel_size * count, programs=options)
     judge_option = options[0].program_family
     judge = ExpertFactory(profile__home_program_family=judge_option)
     context.add_judge(assigned=False, complete=False, judge=judge)
     programs = chain(options[1:], options * panel_size)
     for app, program in zip(context.applications, programs):
         StartupProgramInterestFactory(startup=app.startup,
                                       program=program,
                                       order=2)
     spis = StartupProgramInterest.objects.filter(order=1,
                                                  program__in=options)
     app_filter = {"startup__startupprograminterest__in": spis}
     apps = Application.objects.filter(**app_filter).values_list("id",
                                                                 flat=True)
     self.assert_matching_allocation(context.judging_round, judge, apps)
Пример #3
0
def _create_batch_program_and_named_group(status, batch_size):
    named_group = NamedGroupFactory()
    programs = ProgramFactory.create_batch(batch_size,
                                           mentor_program_group=named_group,
                                           program_status=status)
    return programs