mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
New implementation of sales channels (#4111)
Co-authored-by: Martin Gross <gross@rami.io>
This commit is contained in:
@@ -323,3 +323,60 @@ class OrganizerTest(SoupTest):
|
||||
p = self.orga1.sso_providers.get()
|
||||
assert p.configuration['scope'] == 'openid email'
|
||||
assert p.configuration['provider_config'] == conf
|
||||
|
||||
def test_sales_channel_add_edit_remove(self):
|
||||
doc = self.post_doc(
|
||||
'/control/organizer/%s/channel/add?type=api' % self.orga1.slug,
|
||||
{
|
||||
'label_0': 'API 1',
|
||||
'identifier': 'custom',
|
||||
},
|
||||
follow=True
|
||||
)
|
||||
assert not doc.select('.has-error, .alert-danger')
|
||||
with scopes_disabled():
|
||||
assert str(self.orga1.sales_channels.get(identifier="api.custom").label) == "API 1"
|
||||
|
||||
doc = self.post_doc(
|
||||
'/control/organizer/%s/channel/api.custom/edit' % self.orga1.slug,
|
||||
{
|
||||
'label_0': 'API 2',
|
||||
},
|
||||
follow=True
|
||||
)
|
||||
assert not doc.select('.has-error, .alert-danger')
|
||||
with scopes_disabled():
|
||||
assert str(self.orga1.sales_channels.get(identifier="api.custom").label) == "API 2"
|
||||
|
||||
doc = self.post_doc(
|
||||
'/control/organizer/%s/channel/api.custom/delete' % self.orga1.slug,
|
||||
{},
|
||||
follow=True
|
||||
)
|
||||
assert not doc.select('.has-error, .alert-danger')
|
||||
with scopes_disabled():
|
||||
assert not self.orga1.sales_channels.filter(identifier="api.custom").exists()
|
||||
|
||||
def test_sales_channel_add_invalid_type(self):
|
||||
doc = self.post_doc(
|
||||
'/control/organizer/%s/channel/add?type=web' % self.orga1.slug,
|
||||
{
|
||||
'label_0': 'API 1',
|
||||
'identifier': 'custom',
|
||||
},
|
||||
follow=True
|
||||
)
|
||||
assert doc.select('.large-link-group')
|
||||
|
||||
def test_sales_channel_delete_invalid(self):
|
||||
doc = self.post_doc(
|
||||
'/control/organizer/%s/channel/web/delete' % self.orga1.slug,
|
||||
{
|
||||
'label_0': 'API 1',
|
||||
'identifier': 'custom',
|
||||
},
|
||||
follow=True
|
||||
)
|
||||
assert doc.select('.alert-danger')
|
||||
with scopes_disabled():
|
||||
assert self.orga1.sales_channels.filter(identifier="web").exists()
|
||||
|
||||
Reference in New Issue
Block a user