1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #22057 -- Ensured reverse_lazy can be used in settings

And without causing a circular import. Thanks Akis Kesoglou for
the report.
This commit is contained in:
Claude Paroz
2014-02-18 10:19:04 +01:00
parent faf6a911ad
commit 45edb9d235
3 changed files with 35 additions and 8 deletions

View File

@@ -15,6 +15,8 @@ from django.shortcuts import redirect
from django.test import TestCase, override_settings
from django.utils import six
from admin_scripts.tests import AdminScriptTestCase
from . import urlconf_outer, middleware, views
from .views import empty_view
@@ -301,6 +303,24 @@ class ReverseLazyTest(TestCase):
self.assertEqual(response.status_code, 200)
class ReverseLazySettingsTest(AdminScriptTestCase):
"""
Test that reverse_lazy can be used in settings without causing a circular
import error.
"""
def setUp(self):
self.write_settings('settings.py', extra="""
from django.core.urlresolvers import reverse_lazy
LOGIN_URL = reverse_lazy('login')""")
def tearDown(self):
self.remove_settings('settings.py')
def test_lazy_in_settings(self):
out, err = self.run_manage(['test'])
self.assertOutput(err, "Ran 0 tests")
class ReverseShortcutTests(TestCase):
urls = 'urlpatterns_reverse.urls'