def test_active_some_left(self): fy = admin.ProductActivatedListFilter(None, {'activated': 'Yes'}, Product, ProductAdmin) qy = list(fy.queryset(None, Product.objects.all())) fn = admin.ProductActivatedListFilter(None, {'activated': 'No'}, Product, ProductAdmin) qn = list(fn.queryset(None, Product.objects.all())) self.assertIn(Product.objects.get(name="active_some_left"), qy) self.assertNotIn(Product.objects.get(name="active_some_left"), qn)
def test_inactive_trivial(self): fy = admin.ProductActivatedListFilter(None, {'activated': 'Yes'}, Product, ProductAdmin) qy = list(fy.queryset(None, Product.objects.all())) fn = admin.ProductActivatedListFilter(None, {'activated': 'No'}, Product, ProductAdmin) qn = list(fn.queryset(None, Product.objects.all())) self.assertNotIn(Product.objects.get(name="deactivated_dec_none"), qy) self.assertIn(Product.objects.get(name="deactivated_dec_none"), qn)