Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
    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
Exemplo n.º 4
0
    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
Exemplo n.º 5
0
 def test_for_list(self):
     self.assertEqual(TestTabbedPatientListGroup,
                      TabbedPatientListGroup.for_list(InvisibleList))
Exemplo n.º 6
0
 def test_for_list(self):
     self.assertEqual(TestTabbedPatientListGroup,
                      TabbedPatientListGroup.for_list(InvisibleList))