Vouchers: Allow to set all addons or bundles as included (#3322)

Co-authored-by: Richard Schreiber <schreiber@rami.io>
This commit is contained in:
Raphael Michel
2023-05-22 11:59:27 +02:00
committed by GitHub
parent 5eff9a86f4
commit c75c080c5c
19 changed files with 241 additions and 23 deletions

View File

@@ -3119,6 +3119,27 @@ class CartBundleTest(CartTestMixin, TestCase):
assert a.item == self.trans
assert a.price == 1.5
@classscope(attr='orga')
def test_simple_bundled_voucher_all_free(self):
v = Voucher.objects.create(item=self.ticket, value=Decimal('0.00'), event=self.event, price_mode='set',
all_bundles_included=True)
self.cm.add_new_items([
{
'item': self.ticket.pk,
'variation': None,
'voucher': v.code,
'count': 1
}
])
self.cm.commit()
cp = CartPosition.objects.get(addon_to__isnull=True)
assert cp.item == self.ticket
assert cp.price == 0
assert cp.addons.count() == 1
a = cp.addons.get()
assert a.item == self.trans
assert a.price == 0
@classscope(attr='orga')
def test_voucher_on_base_product(self):
v = self.event.vouchers.create(code="foo", item=self.ticket)