Added test for filtering JSONField key transforms with quoted strings.
This commit is contained in:
parent
fecfec6deb
commit
bec415b290
|
@ -276,6 +276,7 @@ class TestQuerying(TestCase):
|
||||||
'j': None,
|
'j': None,
|
||||||
'k': {'l': 'm'},
|
'k': {'l': 'm'},
|
||||||
'n': [None],
|
'n': [None],
|
||||||
|
'o': '"quoted"',
|
||||||
},
|
},
|
||||||
[1, [2]],
|
[1, [2]],
|
||||||
{'k': True, 'l': False, 'foo': 'bax'},
|
{'k': True, 'l': False, 'foo': 'bax'},
|
||||||
|
@ -774,6 +775,12 @@ class TestQuerying(TestCase):
|
||||||
def test_key_iregex(self):
|
def test_key_iregex(self):
|
||||||
self.assertIs(NullableJSONModel.objects.filter(value__foo__iregex=r'^bAr$').exists(), True)
|
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')
|
@skipUnlessDBFeature('has_json_operators')
|
||||||
def test_key_sql_injection(self):
|
def test_key_sql_injection(self):
|
||||||
with CaptureQueriesContext(connection) as queries:
|
with CaptureQueriesContext(connection) as queries:
|
||||||
|
|
Loading…
Reference in New Issue