diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-04-14 12:23:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-14 12:23:47 +0200 |
| commit | 23fa29f6a6659e0f600d216de6bcb79e7f6818c9 (patch) | |
| tree | ff1fc7ace7f9efaa6e9ea11ba5effd0a557fb5b4 /tests | |
| parent | a77c9a4229cfef790ec18001b2cd18bd9c4aedbc (diff) | |
Fixed #32649 -- Fixed ModelAdmin.search_fields crash when searching against phrases with unbalanced quotes.
Thanks Dlis for the report.
Regression in 26a413507abb38f7eee4cf62f2ee9727fdc7bf8d.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/admin_views/tests.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 69d03c3a95..4ec1c90349 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -3541,6 +3541,7 @@ class AdminSearchTest(TestCase): cls.per2 = Person.objects.create(name='Grace Hopper', gender=1, alive=False) cls.per3 = Person.objects.create(name='Guido van Rossum', gender=1, alive=True) Person.objects.create(name='John Doe', gender=1) + Person.objects.create(name='John O"Hara', gender=1) Person.objects.create(name="John O'Hara", gender=1) cls.t1 = Recommender.objects.create() @@ -3616,7 +3617,7 @@ class AdminSearchTest(TestCase): response = self.client.get(reverse('admin:admin_views_person_changelist') + '?q=Gui') self.assertContains( response, - """<span class="small quiet">1 result (<a href="?">5 total</a>)</span>""", + """<span class="small quiet">1 result (<a href="?">6 total</a>)</span>""", html=True ) @@ -3647,7 +3648,10 @@ class AdminSearchTest(TestCase): ("John Doe John", 0), ('"John Do"', 1), ("'John Do'", 1), + ("'John O\'Hara'", 0), ("'John O\\'Hara'", 1), + ('"John O\"Hara"', 0), + ('"John O\\"Hara"', 1), ] for search, hits in tests: with self.subTest(search=search): |
