forked from CGM_Public/pretix_original
Add flag testmode_supported to sales channels (#1455)
* Add testmode-support-flag to SalesChannels * Make saleschannels/testmode-warnings even more dangerous! * Add warning for payment-methods that do support testmode but are being used in a non-testmode order caused by a saleschannel in a testmode-shop. * Remove redundant testmode_supported-flag for WebshopSalesChannel * Raise error on API when sales_channel does not support testmode * Tests * Fix style issue after merge
This commit is contained in:
committed by
Raphael Michel
parent
e8a2f7e349
commit
2b18621c76
@@ -9,6 +9,7 @@ from django.utils.timezone import now
|
||||
from django_countries.fields import Country
|
||||
from django_scopes import scopes_disabled
|
||||
|
||||
from pretix.base.channels import SalesChannel
|
||||
from pretix.base.decimal import round_decimal
|
||||
from pretix.base.models import (
|
||||
CartPosition, Event, InvoiceAddress, Item, ItemCategory, ItemVariation,
|
||||
@@ -24,6 +25,13 @@ from pretix.testutils.scope import classscope
|
||||
from pretix.testutils.sessions import get_cart_session_key
|
||||
|
||||
|
||||
class FoobarSalesChannel(SalesChannel):
|
||||
identifier = "bar"
|
||||
verbose_name = "Foobar"
|
||||
icon = "home"
|
||||
testmode_supported = True
|
||||
|
||||
|
||||
class CartTestMixin:
|
||||
@scopes_disabled()
|
||||
def setUp(self):
|
||||
@@ -759,7 +767,7 @@ class CartTest(CartTestMixin, TestCase):
|
||||
self.ticket.save()
|
||||
self.client.post('/%s/%s/cart/add' % (self.orga.slug, self.event.slug), {
|
||||
'item_%d' % self.ticket.id: '1',
|
||||
}, follow=True, PRETIX_SALES_CHANNEL='bar')
|
||||
}, follow=True, PRETIX_SALES_CHANNEL=FoobarSalesChannel)
|
||||
with scopes_disabled():
|
||||
self.assertEqual(CartPosition.objects.filter(cart_id=self.session_key, event=self.event).count(), 1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user