extend the helper functions with the escape function
When the object_to_find string contained a special character which the django template system escapes then the test filed because the helpers where looking for the unescaped string. Now they escape the string as well.
This commit is contained in:
parent
b57f6dcb3d
commit
67fa2792d9
|
@ -1,12 +1,15 @@
|
|||
from django.utils.html import escape
|
||||
|
||||
|
||||
def in_content(response, object_to_find):
|
||||
decoded_content = response.content.decode('utf8')
|
||||
if str(object_to_find) not in decoded_content:
|
||||
if str(escape(object_to_find)) not in decoded_content:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def not_in_content(response, object_to_find):
|
||||
decoded_content = response.content.decode('utf8')
|
||||
if str(object_to_find) in decoded_content:
|
||||
if str(escape(object_to_find)) in decoded_content:
|
||||
return False
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue