def test_read_write(self): record_type = FCGI_DATA request_id = randint(1, 65535) data = binary_data() record = Record(record_type, data, request_id) conn = Connection(self.sock) conn.write_record(record) self.sock.flip() record = conn.read_record() assert record.type == record_type assert record.content == data assert record.request_id == request_id assert conn.read_record() is None
def test_read_write(self): record_type = FCGI_DATA request_id = randint(1, 65535) data = binary_data() record = Record(record_type, data, request_id) conn = Connection(self.sock) conn.write_record(record) self.sock.flip() record = conn.read_record() assert record.type == record_type assert record.content == data assert record.request_id == request_id assert conn.read_record() is None
def test_read_write_long_content(self): data = binary_data(FCGI_MAX_CONTENT_LEN + 1) conn = Connection(self.sock) with self.assertRaises(ValueError): conn.write_record(Record(FCGI_STDERR, data, 1))
def test_read_write_long_content(self): data = binary_data(FCGI_MAX_CONTENT_LEN + 1) conn = Connection(self.sock) with self.assertRaises(ValueError): conn.write_record(Record(FCGI_STDERR, data, 1))