X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=quotes%2Fconftest.py;h=26ac8efe0b44e9db997681542358e62e7c125349;hb=98fc1560b227794a7cbf26c1b00eaec8e7e51925;hp=b87a6baf2a756894143ec20c6f2db398144f8f01;hpb=ac8dcbf73da18db58cedc61cb79882b8bf3e74b1;p=djsite.git diff --git a/quotes/conftest.py b/quotes/conftest.py index b87a6ba..26ac8ef 100644 --- a/quotes/conftest.py +++ b/quotes/conftest.py @@ -1,11 +1,13 @@ import pytest import lxml.etree +import html5lib +import urlparse class ValidatingClient(object): def __init__(self, client): self.client = client - + def request(self, url, method, exp_status=200, params={}): if not url.startswith('/quotes/'): url = '/quotes/' + url @@ -21,7 +23,12 @@ class ValidatingClient(object): return None assert response.charset == 'utf-8' document = response.content.decode(response.charset) - lxml.etree.fromstring(document) + print 'For url %s got page:\n%s' % (url, document) + lxml.etree.fromstring(document.replace('
', '
')) + + parser = html5lib.HTMLParser(strict=True) + parser.parse(document) + assert '