def test_for_list_raises_if_non_list_passed(self): with self.assertRaises(ValueError): TabbedPatientListGroup.for_list(None) with self.assertRaises(ValueError): TabbedPatientListGroup.for_list(2) with self.assertRaises(ValueError): TabbedPatientListGroup.for_list('Carnivores') with self.assertRaises(ValueError): TabbedPatientListGroup.for_list(OpalTestCase)
def get_context_data(self, **kwargs): context = super(PatientListTemplateView, self).get_context_data(**kwargs) list_slug = None if self.patient_list: list_slug = self.patient_list.get_slug() context['list_slug'] = list_slug context['patient_list'] = self.patient_list context['lists'] = PatientList.for_user(self.request.user) context['list_group'] = None if self.patient_list: group = TabbedPatientListGroup.for_list(self.patient_list) if group: if group.visible_to(self.request.user): context['list_group'] = group context['columns'] = self.get_column_context(**kwargs) return context
def get_context_data(self, **kwargs): context = super( PatientListTemplateView, self ).get_context_data(**kwargs) list_slug = None if self.patient_list: list_slug = self.patient_list.get_slug() context['list_slug'] = list_slug context['patient_list'] = self.patient_list context['lists'] = list(PatientList.for_user(self.request.user)) context['num_lists'] = len(context['lists']) context['list_group'] = None if self.patient_list: group = TabbedPatientListGroup.for_list(self.patient_list) if group: if group.visible_to(self.request.user): context['list_group'] = group context['columns'] = self.get_column_context(**kwargs) return context
def test_for_list(self): self.assertEqual(TestTabbedPatientListGroup, TabbedPatientListGroup.for_list(InvisibleList))