summaryrefslogtreecommitdiff
path: root/tests/postgres_tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2020-02-05 14:31:30 +0100
committerGitHub <noreply@github.com>2020-02-05 14:31:30 +0100
commit7fa1a93c6c8109010a6ff3f604fda83b604e0e97 (patch)
treea1527b912956cbb2dddcbaeb6f8bc49cfe21d9e0 /tests/postgres_tests
parentde1924e0e7499535f05298c46d9983fd1640d4b4 (diff)
Refs #28214 -- Added test for escaping JSONField key lookups.
Thanks mrsanders for the report. Fixed in 7deeabc7c7526786df6894429ce89a9c4b614086.
Diffstat (limited to 'tests/postgres_tests')
-rw-r--r--tests/postgres_tests/test_json.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_json.py b/tests/postgres_tests/test_json.py
index 0ffa05f981..2ff765e918 100644
--- a/tests/postgres_tests/test_json.py
+++ b/tests/postgres_tests/test_json.py
@@ -411,6 +411,10 @@ class TestQuerying(PostgreSQLTestCase):
**{lookup: value},
).exists())
+ def test_key_escape(self):
+ obj = JSONModel.objects.create(field={'%total': 10})
+ self.assertEqual(JSONModel.objects.filter(**{'field__%total': 10}).get(), obj)
+
@isolate_apps('postgres_tests')
class TestChecks(PostgreSQLSimpleTestCase):