File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 1+ from operator import attrgetter
2+
13from django .db .models import Value
24from django .test import TestCase
35
@@ -80,12 +82,12 @@ def test_update_tuple_value(self):
8082
8183class QueryDollarPrefixTests (MongoTestCaseMixin , TestCase ):
8284 def test_query_injection (self ):
83- """$-prefixed Value() expressions are correctly handled on update ."""
85+ """$-prefixed Value() expressions are correctly handled on query ."""
8486 Author .objects .create (name = "Gustavo" )
8587 Author .objects .create (name = "Walter" )
8688 with self .assertNumQueries (1 ) as ctx :
8789 qs = list (Author .objects .annotate (a_value = Value ("$name" )))
88- self .assertTrue ( all ( v . a_value == "$name" for v in qs ))
90+ self .assertQuerySetEqual ( qs , [ "$name" ] * 2 , attrgetter ( "a_value" ))
8991 self .assertAggregateQuery (
9092 ctx .captured_queries [0 ]["sql" ],
9193 "basic__author" ,
You can’t perform that action at this time.
0 commit comments