def assert_judge_feature_filter(self, name, options, field):
     context = AnalyzeJudgingContext(type="judge",
                                     name=name,
                                     read_count=1,
                                     options=options)
     judge_with_panels = [
         _judge_with_panel(context, field, option) for option in options
     ]
     count = len(options)
     context.add_applications(context.scenario.panel_size * count)
     for counter, app in enumerate(context.applications):
         (option, judge, panel) = judge_with_panels[counter % count]
         context.add_feedback(application=app, judge=judge, panel=panel)
     example = judge_with_panels[0]
     new_judge = ExpertFactory(**{field: example.option})
     context.add_judge(assigned=False, complete=False, judge=new_judge)
     with self.login(email=self.basic_user().email):
         url = reverse(AllocateApplicationsView.view_name,
                       args=[context.judging_round.id, new_judge.id])
         self.client.get(url)
         example_apps = example.judge.judgepanelassignment_set.values_list(
             "panel__applicationpanelassignment__application_id", flat=True)
         new_judge_apps = new_judge.judgepanelassignment_set.values_list(
             "panel__applicationpanelassignment__application_id", flat=True)
         assert set(example_apps).intersection(new_judge_apps) == set()
 def test_get_no_app_for_judge(self):
     context = AnalyzeJudgingContext()
     for app in context.applications:
         if not app.judgeapplicationfeedback_set.filter(
                 judge=context.judge).exists():
             context.add_feedback(application=app,
                                  judge=context.judge,
                                  panel=context.panel)
     with self.login(email=self.basic_user().email):
         url = reverse(AllocateApplicationsView.view_name,
                       args=[context.judging_round.id, context.judge.id])
         response = self.client.get(url)
         assert response.status_code == 403
         assert [
             NO_APP_LEFT_FOR_JUDGE.format(context.judge.email)
             in response.data
         ]