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
@@ -12,6 +12,7 @@ from django_scopes import scopes_disabled
|
||||
from pytz import timezone
|
||||
from tests.base import SoupTest
|
||||
|
||||
from pretix.base.channels import SalesChannel
|
||||
from pretix.base.models import (
|
||||
Event, Item, ItemCategory, ItemVariation, Order, Organizer, Quota, Team,
|
||||
User, WaitingListEntry,
|
||||
@@ -19,6 +20,13 @@ from pretix.base.models import (
|
||||
from pretix.base.models.items import SubEventItem, SubEventItemVariation
|
||||
|
||||
|
||||
class FoobarSalesChannel(SalesChannel):
|
||||
identifier = "bar"
|
||||
verbose_name = "Foobar"
|
||||
icon = "home"
|
||||
testmode_supported = True
|
||||
|
||||
|
||||
class EventTestMixin:
|
||||
@scopes_disabled()
|
||||
def setUp(self):
|
||||
@@ -109,7 +117,7 @@ class ItemDisplayTest(EventTestMixin, SoupTest):
|
||||
q.items.add(item)
|
||||
html = self.client.get('/%s/%s/' % (self.orga.slug, self.event.slug)).rendered_content
|
||||
self.assertNotIn("Early-bird", html)
|
||||
html = self.client.get('/%s/%s/' % (self.orga.slug, self.event.slug), PRETIX_SALES_CHANNEL="bar").rendered_content
|
||||
html = self.client.get('/%s/%s/' % (self.orga.slug, self.event.slug), PRETIX_SALES_CHANNEL=FoobarSalesChannel).rendered_content
|
||||
self.assertIn("Early-bird", html)
|
||||
|
||||
def test_timely_available(self):
|
||||
|
||||
Reference in New Issue
Block a user