import pytest import lxml.etree class ValidatingClient(object): def __init__(self, client): self.client = client def request(self, url, method, exp_status=200, params={}): if method == 'get': response = self.client.get('/quotes/' + url) elif method == 'post': response = self.client.post('/quotes/' + url, params) else: raise RuntimeError('Unknown method %s for %s' % (method, url)) assert response.status_code == exp_status assert response.charset == 'utf-8' document = response.content.decode(response.charset) lxml.etree.fromstring(document) assert '