mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Add a simple test mode (#1181)
- [x] Provide data model and configuration toggle - [x] Allow to delete individual test orders - [x] Add tests - [x] Add a prominent warning message to the backend if test mode orders exist (even though test mode is off), as this leads to wrong statistics - [x] Decide if and how to generate invoices for test orders as invoice numbers cannot be repeated or should not have gaps. - [x] Decide if and how we expose test orders through the API, since our difference pull mechanism relies on the fact that orders cannot be deleted. - [x] Decide if and how we want to couple test modes of payment providers? - [ ] pretix.eu: Ignore test orders for billing - [ ] Adjust payment providers: Mollie, bitpay, cash, fakepayment, sepadebit 
This commit is contained in:
@@ -1799,3 +1799,35 @@ class CheckoutTestCase(TestCase):
|
||||
response = self.client.post('/%s/%s/checkout/confirm/' % (self.orga.slug, self.event.slug), follow=True)
|
||||
doc = BeautifulSoup(response.rendered_content, "lxml")
|
||||
self.assertEqual(len(doc.select(".thank-you")), 1)
|
||||
|
||||
def test_create_testmode_order_in_testmode(self):
|
||||
self.event.testmode = True
|
||||
self.event.save()
|
||||
CartPosition.objects.create(
|
||||
event=self.event, cart_id=self.session_key, item=self.ticket,
|
||||
price=23, expires=now() + timedelta(minutes=10)
|
||||
)
|
||||
self._set_session('payment', 'banktransfer')
|
||||
|
||||
response = self.client.get('/%s/%s/checkout/confirm/' % (self.orga.slug, self.event.slug), follow=True)
|
||||
assert "test mode" in response.rendered_content
|
||||
response = self.client.post('/%s/%s/checkout/confirm/' % (self.orga.slug, self.event.slug), follow=True)
|
||||
doc = BeautifulSoup(response.rendered_content, "lxml")
|
||||
self.assertEqual(len(doc.select(".thank-you")), 1)
|
||||
assert Order.objects.last().testmode
|
||||
assert Order.objects.last().code[1] == "0"
|
||||
|
||||
def test_do_not_create_testmode_order_without_testmode(self):
|
||||
CartPosition.objects.create(
|
||||
event=self.event, cart_id=self.session_key, item=self.ticket,
|
||||
price=23, expires=now() + timedelta(minutes=10)
|
||||
)
|
||||
self._set_session('payment', 'banktransfer')
|
||||
|
||||
response = self.client.get('/%s/%s/checkout/confirm/' % (self.orga.slug, self.event.slug), follow=True)
|
||||
assert "test mode" not in response.rendered_content
|
||||
response = self.client.post('/%s/%s/checkout/confirm/' % (self.orga.slug, self.event.slug), follow=True)
|
||||
doc = BeautifulSoup(response.rendered_content, "lxml")
|
||||
self.assertEqual(len(doc.select(".thank-you")), 1)
|
||||
assert not Order.objects.last().testmode
|
||||
assert "0" not in Order.objects.last().code
|
||||
|
||||
Reference in New Issue
Block a user