def test_header(self): response = HttpResponse(self.sock) response.begin() self.assertEquals(200, response.status) self.assertEquals('OK', response.reason) headers = list(map(lambda (x, y): x, response.getheaders())) self.assertIn('date', headers) self.assertIn('connection', headers)
def test_header(self): response = HttpResponse(self.sock) response.begin() self.assertEquals(200, response.status) self.assertEquals('OK', response.reason) headers = list(map(lambda (x,y): x, response.getheaders())) self.assertIn('date', headers) self.assertIn('connection', headers)
def test_raw_read(self): response = HttpResponse(self.sock) response.begin() all_data = '' while True: data = response.read(raw=True) if not data: break all_data += data self.assertEquals(''.join(self.RAW_DATA).strip(), all_data)
def test_normal_read(self): response = HttpResponse(self.sock) response.begin() data = response.read() self.assertEquals(self.HTML_DATA, data)