mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #31114 -- Fixed HttpRequest.build_absolute_uri() crash with reverse_lazy() locations.
This commit is contained in:
parent
5660267e5b
commit
e42b68debf
2 changed files with 14 additions and 1 deletions
|
@ -13,7 +13,9 @@ from django.http import (
|
|||
HttpRequest, HttpResponsePermanentRedirect, HttpResponseRedirect,
|
||||
)
|
||||
from django.shortcuts import redirect
|
||||
from django.test import SimpleTestCase, TestCase, override_settings
|
||||
from django.test import (
|
||||
RequestFactory, SimpleTestCase, TestCase, override_settings,
|
||||
)
|
||||
from django.test.utils import override_script_prefix
|
||||
from django.urls import (
|
||||
NoReverseMatch, Resolver404, ResolverMatch, URLPattern, URLResolver,
|
||||
|
@ -529,6 +531,14 @@ class ReverseLazyTest(TestCase):
|
|||
'Some URL: /login/'
|
||||
)
|
||||
|
||||
def test_build_absolute_uri(self):
|
||||
factory = RequestFactory()
|
||||
request = factory.get('/')
|
||||
self.assertEqual(
|
||||
request.build_absolute_uri(reverse_lazy('some-login-page')),
|
||||
'http://testserver/login/',
|
||||
)
|
||||
|
||||
|
||||
class ReverseLazySettingsTest(AdminScriptTestCase):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue