def test_push_promise_frame_serializes_properly(self): f = PushPromiseFrame(1) f.flags = set(['END_HEADERS']) f.promised_stream_id = 4 f.data = b'hello world' s = f.serialize() assert s == (b'\x00\x00\x0F\x05\x04\x00\x00\x00\x01' + b'\x00\x00\x00\x04' + b'hello world')
def test_push_promise_frame_serializes_properly(self): f = PushPromiseFrame(1) f.flags = set(['END_HEADERS']) f.promised_stream_id = 4 f.data = b'hello world' s = f.serialize() assert s == ( b'\x00\x00\x0F\x05\x04\x00\x00\x00\x01' + b'\x00\x00\x00\x04' + b'hello world' )
def build_push_promise_frame(self, stream_id, promised_stream_id, headers, flags=[]): """ Builds a single PUSH_PROMISE frame. """ f = PushPromiseFrame(stream_id) f.promised_stream_id = promised_stream_id f.data = self.encoder.encode(headers) f.flags = set(flags) return f