mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #30121 -- Fixed assertURLEqual() crash with reverse_lazy() URLs.
Regression in 24959e48d9.
This commit is contained in:
@@ -22,7 +22,7 @@ from django.test.utils import (
|
||||
CaptureQueriesContext, TestContextDecorator, isolate_apps,
|
||||
override_settings, setup_test_environment,
|
||||
)
|
||||
from django.urls import NoReverseMatch, path, reverse
|
||||
from django.urls import NoReverseMatch, path, reverse, reverse_lazy
|
||||
|
||||
from .models import Car, Person, PossessedCar
|
||||
from .views import empty_response
|
||||
@@ -961,6 +961,7 @@ class AssertFieldOutputTests(SimpleTestCase):
|
||||
self.assertFieldOutput(MyCustomField, {}, {}, empty_value=None)
|
||||
|
||||
|
||||
@override_settings(ROOT_URLCONF='test_utils.urls')
|
||||
class AssertURLEqualTests(SimpleTestCase):
|
||||
def test_equal(self):
|
||||
valid_tests = (
|
||||
@@ -971,6 +972,7 @@ class AssertURLEqualTests(SimpleTestCase):
|
||||
('http://example.com/?x=1&y=2&a=1&a=2', 'http://example.com/?a=1&a=2&y=2&x=1'),
|
||||
('/path/to/?x=1&y=2&z=3', '/path/to/?z=3&y=2&x=1'),
|
||||
('?x=1&y=2&z=3', '?z=3&y=2&x=1'),
|
||||
('/test_utils/no_template_used/', reverse_lazy('no_template_used')),
|
||||
)
|
||||
for url1, url2 in valid_tests:
|
||||
with self.subTest(url=url1):
|
||||
|
||||
@@ -4,5 +4,5 @@ from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('test_utils/get_person/<int:pk>/', views.get_person),
|
||||
path('test_utils/no_template_used/', views.no_template_used),
|
||||
path('test_utils/no_template_used/', views.no_template_used, name='no_template_used'),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user