forked from CGM_Public/pretix_original
Allow to disable self-choice seating
This commit is contained in:
@@ -2098,7 +2098,12 @@ class OrderChangeManagerTests(TestCase):
|
||||
self.ocm.commit()
|
||||
|
||||
@classscope(attr='o')
|
||||
def test_add_with_seat_required(self):
|
||||
def test_add_with_seat_not_required_if_no_choice(self):
|
||||
self.event.settings.seating_choice = False
|
||||
self.ocm.add_position(self.stalls, None, price=Decimal('13.00'))
|
||||
|
||||
@classscope(attr='o')
|
||||
def test_add_with_seat_not_required(self):
|
||||
with self.assertRaises(OrderError):
|
||||
self.ocm.add_position(self.stalls, None, price=Decimal('13.00'))
|
||||
|
||||
|
||||
@@ -3685,6 +3685,25 @@ class CartSeatingTest(CartTestMixin, TestCase):
|
||||
objs = list(CartPosition.objects.filter(cart_id=self.session_key, event=self.event))
|
||||
self.assertEqual(len(objs), 0)
|
||||
|
||||
def test_add_seat_not_required_if_no_choice(self):
|
||||
self.event.settings.seating_choice = False
|
||||
self.client.post('/%s/%s/cart/add' % (self.orga.slug, self.event.slug), {
|
||||
'item_%d' % self.ticket.id: '1',
|
||||
}, follow=True)
|
||||
with scopes_disabled():
|
||||
objs = list(CartPosition.objects.filter(cart_id=self.session_key, event=self.event))
|
||||
self.assertEqual(len(objs), 1)
|
||||
assert objs[0].seat is None
|
||||
|
||||
def test_seat_not_allowed_if_no_choice(self):
|
||||
self.event.settings.seating_choice = False
|
||||
self.client.post('/%s/%s/cart/add' % (self.orga.slug, self.event.slug), {
|
||||
'seat_%d' % self.ticket.id: self.seat_a2.seat_guid,
|
||||
}, follow=True)
|
||||
with scopes_disabled():
|
||||
objs = list(CartPosition.objects.filter(cart_id=self.session_key, event=self.event))
|
||||
self.assertEqual(len(objs), 0)
|
||||
|
||||
def test_add_with_seat_with_variation(self):
|
||||
with scopes_disabled():
|
||||
v1 = self.ticket.variations.create(value='Regular', active=True)
|
||||
|
||||
@@ -3244,6 +3244,13 @@ class CheckoutSeatingTest(BaseCheckoutTestCase, TestCase):
|
||||
_perform_order(self.event, 'manual', [self.cp1.pk], 'admin@example.org', 'en', None, {}, 'web')
|
||||
assert not CartPosition.objects.filter(pk=self.cp1.pk).exists()
|
||||
|
||||
@scopes_disabled()
|
||||
def test_seat_not_required_if_no_choice(self):
|
||||
self.cp1.seat = None
|
||||
self.cp1.save()
|
||||
self.event.settings.seating_choice = False
|
||||
_perform_order(self.event, 'manual', [self.cp1.pk], 'admin@example.org', 'en', None, {}, 'web')
|
||||
|
||||
@scopes_disabled()
|
||||
def test_seat_not_allowed(self):
|
||||
self.cp1.item = self.workshop1
|
||||
|
||||
Reference in New Issue
Block a user