def test_filter_by_monitors(self): """ Test to filter discipline monitors. """ response = self.client.get('{0}?filter=monitors'.format(self.url)) context = response.context['students'] monitors = self.discipline.monitors.all() self.assertEqual(list_transform(context), list_transform(monitors))
def test_to_search_discipline(self): """ Search a specific discipline. """ response = self.client.get('{0}?q_info=Discipline02'.format(self.url)) disciplines = response.context['disciplines'] self.assertEqual(disciplines.count(), 2) searched = Discipline.objects.search('Discipline02') self.assertEqual(list_transform(disciplines), list_transform(searched))
def test_order_by_teacher(self): """ Test to order disciplines by teacher. """ response = self.client.get('{0}?order=teacher__name'.format(self.url)) disciplines = response.context['disciplines'] ordered = Discipline.objects.available( user=self.teacher).order_by('teacher__name') self.assertEqual(list_transform(disciplines), list_transform(ordered))