forked from CGM_Public/pretix_original
Tests: Fix improper cleanup of SITE_URL
This commit is contained in:
@@ -20,19 +20,19 @@
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
from django import urls
|
||||
from django.conf import settings
|
||||
from django.test import override_settings
|
||||
|
||||
from pretix.helpers.urls import build_absolute_uri
|
||||
|
||||
|
||||
def test_site_url_domain():
|
||||
settings.SITE_URL = 'https://example.com'
|
||||
assert build_absolute_uri('control:auth.login') == 'https://example.com/control/login'
|
||||
with override_settings(SITE_URL='https://example.com'):
|
||||
assert build_absolute_uri('control:auth.login') == 'https://example.com/control/login'
|
||||
|
||||
|
||||
def test_site_url_subpath():
|
||||
settings.SITE_URL = 'https://example.com/presale'
|
||||
old_prefix = urls.get_script_prefix()
|
||||
urls.set_script_prefix('/presale/')
|
||||
assert build_absolute_uri('control:auth.login') == 'https://example.com/presale/control/login'
|
||||
urls.set_script_prefix(old_prefix)
|
||||
with override_settings(SITE_URL='https://example.com/presale'):
|
||||
old_prefix = urls.get_script_prefix()
|
||||
urls.set_script_prefix('/presale/')
|
||||
assert build_absolute_uri('control:auth.login') == 'https://example.com/presale/control/login'
|
||||
urls.set_script_prefix(old_prefix)
|
||||
|
||||
Reference in New Issue
Block a user