def test_list_view_status_filtering(self): ProductAlertFactory.create_batch(3, status=ProductAlert.CANCELLED) ProductAlertFactory.create_batch(2, status=ProductAlert.ACTIVE) response = self.get(reverse('dashboard:user-alert-list'), params={'status': ProductAlert.ACTIVE}) self.assertEqual(len(response.context['alerts']), 2)
def test_list_view_get_queryset_ordering(self): ProductAlertFactory.create_batch(3) response = self.get(reverse('dashboard:user-alert-list')) self.assertEqual( list(response.context['alerts']), list(ProductAlert.objects.order_by('-date_created')) )
def test_list_view_get_queryset_ordering(self): ProductAlertFactory.create_batch(3) response = self.get(reverse('dashboard:user-alert-list')) self.assertEqual(list(response.context['alerts']), list(ProductAlert.objects.order_by('-date_created')))