File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -172,11 +172,14 @@ def test_smart_link_field(self):
172172
173173 def test_autocomplete_view (self ):
174174 tricky_title = """d'acceuil: <script>alert("XSS");</script>"""
175-
176175 page = self .create_page (
177176 title = tricky_title ,
178177 template = "page.html" ,
179178 )
179+ expected_choices = [
180+ "home" , "content" , tricky_title ,
181+ ]
182+
180183 self .publish (page , self .language )
181184 autocomplete_url = admin_reverse ("link_link_autocomplete" )
182185
@@ -187,11 +190,6 @@ def test_autocomplete_view(self):
187190 choices = autocomplete_result .get ("results" )[0 ]
188191
189192 self .assertFalse ((autocomplete_result .get ("pagination" ) or {}).get ("more" ))
190- self .assertEqual (
191- choices .get ("children" ),
192- [
193- {'id' : '2-1' , 'text' : 'home' },
194- {'id' : '2-2' , 'text' : 'content' },
195- {'id' : '2-3' , 'text' : tricky_title },
196- ]
197- )
193+
194+ for expected , sent in zip (expected_choices , choices .get ("children" )):
195+ self .assertEqual (expected , sent .get ("text" ))
You can’t perform that action at this time.
0 commit comments