mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Fix price calculation of included add-ons in expired carts
This commit is contained in:
@@ -2380,6 +2380,25 @@ class CartAddonTest(CartTestMixin, TestCase):
|
||||
assert cp2.item == self.workshop1
|
||||
assert cp2.price == 0
|
||||
|
||||
@classscope(attr='orga')
|
||||
def test_extend_included_addon(self):
|
||||
self.addon1.price_included = True
|
||||
self.addon1.save()
|
||||
cp1 = CartPosition.objects.create(
|
||||
expires=now() - timedelta(minutes=10), item=self.ticket, price=Decimal('23.00'),
|
||||
event=self.event, cart_id=self.session_key
|
||||
)
|
||||
cp2 = CartPosition.objects.create(
|
||||
expires=now() - timedelta(minutes=10), item=self.workshop1, price=Decimal('0.00'),
|
||||
event=self.event, cart_id=self.session_key, addon_to=cp1
|
||||
)
|
||||
self.cm.extend_expired_positions()
|
||||
self.cm.commit()
|
||||
cp2.refresh_from_db()
|
||||
assert cp2.expires > now()
|
||||
assert cp2.item == self.workshop1
|
||||
assert cp2.price == 0
|
||||
|
||||
@classscope(attr='orga')
|
||||
def test_cart_addon_remove_parent(self):
|
||||
self.addon1.price_included = True
|
||||
|
||||
Reference in New Issue
Block a user