Пример #1
0
    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)
Пример #2
0
    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)
Пример #3
0
    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)
Пример #4
0
    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)
Пример #5
0
    def test_normal_read(self):
        response = HttpResponse(self.sock)
        response.begin()

        data = response.read()
        self.assertEquals(self.HTML_DATA, data)
Пример #6
0
    def test_normal_read(self):
        response = HttpResponse(self.sock)
        response.begin()

        data = response.read()
        self.assertEquals(self.HTML_DATA, data)