New implementation of sales channels (#4111)

Co-authored-by: Martin Gross <gross@rami.io>
This commit is contained in:
Raphael Michel
2024-06-30 19:24:30 +02:00
committed by GitHub
parent 95511b0330
commit 4fb5c6bef0
174 changed files with 2902 additions and 616 deletions

View File

@@ -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()