Fix error in price calculation in connection with free prices and bundles

This commit is contained in:
Raphael Michel
2020-07-21 17:23:08 +02:00
parent 8bebea61f1
commit 7bd9a01f5e
2 changed files with 27 additions and 3 deletions

View File

@@ -2722,6 +2722,27 @@ class CartBundleTest(CartTestMixin, TestCase):
assert a.item == self.trans
assert a.price == 1.5
@classscope(attr='orga')
def test_simple_bundle_main_enforce_free_price_minimum(self):
self.ticket.free_price = True
self.ticket.save()
self.cm.add_new_items([
{
'item': self.ticket.pk,
'variation': None,
'price': '21.50',
'count': 1
}
])
self.cm.commit()
cp = CartPosition.objects.get(addon_to__isnull=True)
assert cp.item == self.ticket
assert cp.price == 23 - 1.5
assert cp.addons.count() == 1
a = cp.addons.get()
assert a.item == self.trans
assert a.price == 1.5
@classscope(attr='orga')
def test_voucher_on_base_product(self):
v = self.event.vouchers.create(code="foo", item=self.ticket)