File tree 1 file changed +7
-9
lines changed
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):
172
172
173
173
def test_autocomplete_view (self ):
174
174
tricky_title = """d'acceuil: <script>alert("XSS");</script>"""
175
-
176
175
page = self .create_page (
177
176
title = tricky_title ,
178
177
template = "page.html" ,
179
178
)
179
+ expected_choices = [
180
+ "home" , "content" , tricky_title ,
181
+ ]
182
+
180
183
self .publish (page , self .language )
181
184
autocomplete_url = admin_reverse ("link_link_autocomplete" )
182
185
@@ -187,11 +190,6 @@ def test_autocomplete_view(self):
187
190
choices = autocomplete_result .get ("results" )[0 ]
188
191
189
192
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