summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2020-11-20 07:25:32 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-11-25 06:55:39 +0100
commita582ef8b89a7e1e6724b6fdab93748c90afcabe3 (patch)
tree17f66e8165da5dc6073cfe41de775d4e48a37601 /tests
parent166c0d2474a3b5e09e1dd96ec93bdbf08f0c65c2 (diff)
[3.1.x] Added test for filtering JSONField key transforms with quoted strings.
Backport of bec415b290b68c07adcd9c67631b6573666d76be from master
Diffstat (limited to 'tests')
-rw-r--r--tests/model_fields/test_jsonfield.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/model_fields/test_jsonfield.py b/tests/model_fields/test_jsonfield.py
index b91d94752f..babc194782 100644
--- a/tests/model_fields/test_jsonfield.py
+++ b/tests/model_fields/test_jsonfield.py
@@ -261,6 +261,7 @@ class TestQuerying(TestCase):
'j': None,
'k': {'l': 'm'},
'n': [None],
+ 'o': '"quoted"',
},
[1, [2]],
{'k': True, 'l': False},
@@ -705,6 +706,12 @@ class TestQuerying(TestCase):
def test_key_iregex(self):
self.assertIs(NullableJSONModel.objects.filter(value__foo__iregex=r'^bAr$').exists(), True)
+ def test_key_quoted_string(self):
+ self.assertEqual(
+ NullableJSONModel.objects.filter(value__o='"quoted"').get(),
+ self.objs[4],
+ )
+
@skipUnlessDBFeature('has_json_operators')
def test_key_sql_injection(self):
with CaptureQueriesContext(connection) as queries: