1
0
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:
Jon Dufresne
2019-01-21 06:31:33 -08:00
committed by Tim Graham
parent 65858119d2
commit d15c61cabb
3 changed files with 5 additions and 2 deletions

View File

@@ -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):