mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
URL generation: Fix bug if plugins declare both event_urls and organizer_urls (#5688)
* URL generation: Fix bug if plugins declare both event_urls and organizer_urls * Add missing file * Add license header
This commit is contained in:
@@ -45,6 +45,8 @@ def env():
|
||||
def test_event_main_domain_front_page(env):
|
||||
assert eventreverse(env[1], 'presale:event.index') == '/mrmcd/2015/'
|
||||
assert eventreverse(env[0], 'presale:organizer.index') == '/mrmcd/'
|
||||
assert eventreverse(env[1], 'plugins:testdummy:view') == '/mrmcd/2015/testdummy'
|
||||
assert eventreverse(env[0], 'plugins:testdummy:view') == '/mrmcd/testdummy'
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@@ -52,12 +54,16 @@ def test_event_custom_domain_kwargs(env):
|
||||
KnownDomain.objects.create(domainname='foobar', organizer=env[0])
|
||||
KnownDomain.objects.create(domainname='barfoo', organizer=env[0], event=env[1])
|
||||
assert eventreverse(env[1], 'presale:event.checkout', {'step': 'payment'}) == 'http://barfoo/checkout/payment/'
|
||||
assert eventreverse(env[0], 'plugins:testdummy:view') == 'http://foobar/testdummy'
|
||||
assert eventreverse(env[1], 'plugins:testdummy:view') == 'http://barfoo/testdummy'
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_event_org_domain_kwargs(env):
|
||||
KnownDomain.objects.create(domainname='foobar', organizer=env[0])
|
||||
assert eventreverse(env[1], 'presale:event.checkout', {'step': 'payment'}) == 'http://foobar/2015/checkout/payment/'
|
||||
assert eventreverse(env[0], 'plugins:testdummy:view') == 'http://foobar/testdummy'
|
||||
assert eventreverse(env[1], 'plugins:testdummy:view') == 'http://foobar/2015/testdummy'
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@@ -65,9 +71,13 @@ def test_event_org_alt_domain_kwargs(env):
|
||||
KnownDomain.objects.create(domainname='foobar', organizer=env[0])
|
||||
d = KnownDomain.objects.create(domainname='altfoo', organizer=env[0], mode=KnownDomain.MODE_ORG_ALT_DOMAIN)
|
||||
assert eventreverse(env[1], 'presale:event.checkout', {'step': 'payment'}) == 'http://foobar/2015/checkout/payment/'
|
||||
assert eventreverse(env[1], 'plugins:testdummy:view') == 'http://foobar/2015/testdummy'
|
||||
d.event_assignments.create(event=env[1])
|
||||
with scopes_disabled():
|
||||
assert eventreverse(Event.objects.get(pk=env[1].pk), 'presale:event.checkout', {'step': 'payment'}) == 'http://altfoo/2015/checkout/payment/'
|
||||
event = Event.objects.get(pk=env[1].pk)
|
||||
assert eventreverse(event, 'presale:event.checkout', {'step': 'payment'}) == 'http://altfoo/2015/checkout/payment/'
|
||||
assert eventreverse(env[0], 'plugins:testdummy:view') == 'http://foobar/testdummy'
|
||||
assert eventreverse(event, 'plugins:testdummy:view') == 'http://altfoo/2015/testdummy'
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
|
||||
52
src/tests/testdummy/urls.py
Normal file
52
src/tests/testdummy/urls.py
Normal file
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# This file is part of pretix (Community Edition).
|
||||
#
|
||||
# Copyright (C) 2014-2020 Raphael Michel and contributors
|
||||
# Copyright (C) 2020-today pretix GmbH and contributors
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
|
||||
# Public License as published by the Free Software Foundation in version 3 of the License.
|
||||
#
|
||||
# ADDITIONAL TERMS APPLY: Pursuant to Section 7 of the GNU Affero General Public License, additional terms are
|
||||
# applicable granting you additional permissions and placing additional restrictions on your usage of this software.
|
||||
# Please refer to the pretix LICENSE file to obtain the full terms applicable to this work. If you did not receive
|
||||
# this file, see <https://pretix.eu/about/en/license>.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
from django.http import HttpResponse
|
||||
from django.urls import path
|
||||
|
||||
|
||||
def view(request):
|
||||
return HttpResponse("")
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path(
|
||||
"testdummy",
|
||||
view,
|
||||
name="view",
|
||||
),
|
||||
]
|
||||
|
||||
organizer_patterns = [
|
||||
path(
|
||||
"testdummy",
|
||||
view,
|
||||
name="view",
|
||||
),
|
||||
]
|
||||
|
||||
event_patterns = [
|
||||
path(
|
||||
"testdummy",
|
||||
view,
|
||||
name="view",
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user