diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-04-14 12:23:47 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-04-14 12:24:11 +0200 |
| commit | 59cce8237c9efb33f16058bac67702d5a11ea1d9 (patch) | |
| tree | c9d7609b31070b6a336edff1ce31f1024f0e2e71 /tests | |
| parent | 700356f93b9185cc05d9ed349108591a70e597b6 (diff) | |
[3.2.x] Fixed #32649 -- Fixed ModelAdmin.search_fields crash when searching against phrases with unbalanced quotes.
Thanks Dlis for the report.
Regression in 26a413507abb38f7eee4cf62f2ee9727fdc7bf8d.
Backport of 23fa29f6a6659e0f600d216de6bcb79e7f6818c9 from main
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 8cb3fda966..ad47c504c1 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -3537,6 +3537,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() @@ -3612,7 +3613,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 ) @@ -3643,7 +3644,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): |
