mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Fix invalid handling of variations with quota-level vouchers
This commit is contained in:
@@ -650,6 +650,15 @@ class VoucherTestCase(BaseQuotaTestCase):
|
||||
self.assertTrue(v.applies_to(self.var1.item, self.var1))
|
||||
self.assertFalse(v.applies_to(self.var1.item, self.var2))
|
||||
|
||||
def test_voucher_applicability_variation_through_quota(self):
|
||||
self.quota.variations.add(self.var1)
|
||||
self.quota.items.add(self.var1.item)
|
||||
v = Voucher.objects.create(quota=self.quota, event=self.event)
|
||||
self.assertFalse(v.applies_to(self.item1))
|
||||
self.assertTrue(v.applies_to(self.var1.item)) # semantics unclear
|
||||
self.assertTrue(v.applies_to(self.var1.item, self.var1))
|
||||
self.assertFalse(v.applies_to(self.var1.item, self.var2))
|
||||
|
||||
def test_voucher_no_item_with_quota(self):
|
||||
with self.assertRaises(ValidationError):
|
||||
v = Voucher(quota=self.quota, item=self.item1, event=self.event)
|
||||
|
||||
Reference in New Issue
Block a user