mirror of
https://github.com/pretix/pretix.git
synced 2026-09-13 16:14:40 +00:00
Add tests
This commit is contained in:
@@ -2372,6 +2372,39 @@ class CheckoutTestCase(BaseCheckoutTestCase, TimemachineTestMixin, TestCase):
|
|||||||
assert p2.fee.value == Decimal("0.46")
|
assert p2.fee.value == Decimal("0.46")
|
||||||
assert o.total == Decimal("25.76")
|
assert o.total == Decimal("25.76")
|
||||||
|
|
||||||
|
def test_payment_postpone_not_allowed(self):
|
||||||
|
self.event.settings.set('payment_banktransfer__enabled', True)
|
||||||
|
with scopes_disabled():
|
||||||
|
CartPosition.objects.create(
|
||||||
|
event=self.event, cart_id=self.session_key, item=self.ticket,
|
||||||
|
price=23, expires=now() + timedelta(minutes=10)
|
||||||
|
)
|
||||||
|
response = self.client.post('/%s/%s/checkout/payment/' % (self.orga.slug, self.event.slug), {
|
||||||
|
'postpone': 'on',
|
||||||
|
}, follow=False)
|
||||||
|
assert 'Please select' in response.content.decode()
|
||||||
|
|
||||||
|
def test_payment_postpone_allowed(self):
|
||||||
|
self.event.settings.set('payment_banktransfer__enabled', True)
|
||||||
|
self.event.settings.payment_choice_postpone_allowed_channels = ['web']
|
||||||
|
with scopes_disabled():
|
||||||
|
CartPosition.objects.create(
|
||||||
|
event=self.event, cart_id=self.session_key, item=self.ticket,
|
||||||
|
price=23, expires=now() + timedelta(minutes=10)
|
||||||
|
)
|
||||||
|
response = self.client.post('/%s/%s/checkout/payment/' % (self.orga.slug, self.event.slug), {
|
||||||
|
'postpone': 'on',
|
||||||
|
}, follow=True)
|
||||||
|
self.assertRedirects(response, '/%s/%s/checkout/confirm/' % (self.orga.slug, self.event.slug),
|
||||||
|
target_status_code=200)
|
||||||
|
|
||||||
|
response = self.client.post('/%s/%s/checkout/confirm/' % (self.orga.slug, self.event.slug), follow=True)
|
||||||
|
doc = BeautifulSoup(response.content.decode(), "lxml")
|
||||||
|
self.assertEqual(len(doc.select(".thank-you")), 1)
|
||||||
|
with scopes_disabled():
|
||||||
|
o = Order.objects.last()
|
||||||
|
assert not o.payments.exists()
|
||||||
|
|
||||||
def test_premature_confirm(self):
|
def test_premature_confirm(self):
|
||||||
response = self.client.get('/%s/%s/checkout/confirm/' % (self.orga.slug, self.event.slug), follow=True)
|
response = self.client.get('/%s/%s/checkout/confirm/' % (self.orga.slug, self.event.slug), follow=True)
|
||||||
self.assertRedirects(response, '/%s/%s/?require_cookie=true' % (self.orga.slug, self.event.slug),
|
self.assertRedirects(response, '/%s/%s/?require_cookie=true' % (self.orga.slug, self.event.slug),
|
||||||
|
|||||||
Reference in New Issue
Block a user