summaryrefslogtreecommitdiff
path: root/tests/template_tests/syntax_tests
diff options
context:
space:
mode:
authorSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-02-12 17:08:03 +0100
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-02-13 15:57:56 +0100
commit65113401f1f6786f8a89dfcb7d0347924b317e7b (patch)
treeaaa7ec1761578ec558495f8d61c72def1e56badb /tests/template_tests/syntax_tests
parent861f9a2427ffbfee2a33cda5ed6a2047916fcfcb (diff)
[5.1.x] 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. Backport of 05002c153c5018e4429a326a6699c7c45e5ea957 from main.
Diffstat (limited to 'tests/template_tests/syntax_tests')
-rw-r--r--tests/template_tests/syntax_tests/test_querystring.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/template_tests/syntax_tests/test_querystring.py b/tests/template_tests/syntax_tests/test_querystring.py
index 3f1cf3d281..099be96f9e 100644
--- a/tests/template_tests/syntax_tests/test_querystring.py
+++ b/tests/template_tests/syntax_tests/test_querystring.py
@@ -17,6 +17,15 @@ class QueryStringTagTests(SimpleTestCase):
output = template.render(context)
self.assertEqual(output, "")
+ @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("/"))
+ template = self.engine.get_template("test_querystring_remove_all_params")
+ for context, expected in [(non_empty_context, "?"), (empty_context, "")]:
+ with self.subTest(expected=expected):
+ self.assertEqual(template.render(context), expected)
+
@setup({"querystring_non_empty": "{% querystring %}"})
def test_querystring_non_empty(self):
request = self.request_factory.get("/", {"a": "b"})