diff options
| author | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-02-12 17:08:03 +0100 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-02-13 15:49:25 +0100 |
| commit | 05002c153c5018e4429a326a6699c7c45e5ea957 (patch) | |
| tree | 89c871eb639ab50a15676bcca21a806e784e7a3e /tests/template_tests | |
| parent | 0ee842bb456cb3854d5546106e1259db83714d34 (diff) | |
Fixed #36182 -- Returned "?" if all parameters are removed in querystring template tag.
Thank you to David Feeley for the report and Natalia Bidart for the review.
Diffstat (limited to 'tests/template_tests')
| -rw-r--r-- | tests/template_tests/syntax_tests/test_querystring.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/template_tests/syntax_tests/test_querystring.py b/tests/template_tests/syntax_tests/test_querystring.py index dea8ee0142..9979bcb8e2 100644 --- a/tests/template_tests/syntax_tests/test_querystring.py +++ b/tests/template_tests/syntax_tests/test_querystring.py @@ -20,6 +20,18 @@ class QueryStringTagTests(SimpleTestCase): "test_querystring_empty_get_params", context, expected="" ) + @setup({"test_querystring_remove_all_params": "{% querystring a=None %}"}) + def test_querystring_remove_all_params(self): + non_empty_context = RequestContext(self.request_factory.get("/?a=b")) + empty_context = RequestContext(self.request_factory.get("/")) + for context, expected in [(non_empty_context, "?"), (empty_context, "")]: + with self.subTest(expected=expected): + self.assertRenderEqual( + "test_querystring_remove_all_params", + context, + expected, + ) + @setup({"test_querystring_non_empty_get_params": "{% querystring %}"}) def test_querystring_non_empty_get_params(self): request = self.request_factory.get("/", {"a": "b"}) |
