def test_request_data(self): request = ClientRequest('GET', '/') data = "Lots of dataaaa" request.add_content(data) self.assertEqual(request.data, json.dumps(data)) self.assertEqual(request.headers.get('Content-Length'), '17')
def test_request_xml(self): request = ClientRequest('GET', '/') data = ET.Element("root") request.add_content(data) assert request.data == b"<?xml version='1.0' encoding='utf8'?>\n<root />"