Skip to content

Commit

Permalink
[tests][xs]: Minor fix for html check routine.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Read committed Jun 27, 2011
1 parent f811080 commit 10b3d77
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions ckan/tests/html_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ class HtmlCheckMethods(object):

def named_div(self, div_name, html):
'strips html to just the <div id="DIV_NAME"> section'
if isinstance(html, paste.fixture.TestResponse):
the_html = html.body.decode('utf8')
elif isinstance(html, basestring):
the_html = html
else:
raise NotImplementedError
the_html = self._get_html_from_res(html)
start_div = the_html.find(u'<div id="%s"' % div_name)
end_div = the_html.find(u'<!-- #%s -->' % div_name)
if end_div == -1:
Expand Down Expand Up @@ -99,7 +94,7 @@ def _check_html(self, regex_compiled, html, html_to_find):
if partly_matching_tags:
assert 0, "Couldn't find %s in html. Closest matches were:\n%s" % (', '.join(["'%s'" % html.encode('utf8') for html in html_to_find]), '\n'.join([tag.encode('utf8') for tag in partly_matching_tags]))
else:
assert 0, "Couldn't find %s in html. Tags matched were:\n%s" % (', '.join(["'%s'" % html.encode('utf8') for html in html_to_find]), '\n'.join([tag.encode('utf8') for tag in regex_compiled.finditer(html_str)]))
assert 0, "Couldn't find %s in html. Tags matched were:\n%s" % (', '.join(["'%s'" % html.encode('utf8') for html in html_to_find]), '\n'.join([tag.group() for tag in regex_compiled.finditer(html_str)]))



Expand Down

0 comments on commit 10b3d77

Please sign in to comment.