Beispiel #1
0
 def test_clean(self):
     products = create_products()
     ds = create_discounts()[0]
     ds.valid_products.add(products[0])
     validator = ProductValidator()
     self.assertRaises(ValidationError, validator.clean, ds, products[1])
     self.assertEqual(ds, validator.clean(ds, products[0]))
Beispiel #2
0
 def test_productvalidator_case3(self):
     products = create_products()
     ds = create_discounts()
     ds[0].valid_products.add(products[0])
     validator = ProductValidator()
     qs = Discount._base_manager.filter(validator.get_q_object(products[0]))
     self.assertEqual(set(ds), set(qs))