def test_decode_with_message_length(dummy_frame): """Verify we can pre-flight a message size.""" dummy_frame[2] = Types.PING_REQ f = frame_rw.read( BytesIO(dummy_frame[2:]), size=len(dummy_frame) ) message_rw = messages.RW[f.header.message_type] message_rw.read(BytesIO(f.payload)) == PingRequestMessage()
def test_decode_empty_buffer(): """Verify we can parse zero size frame.""" assert frame_rw.read(BytesIO(b'\x00\x00\x00\x00')) is None
def test_decode_with_message_length(dummy_frame): """Verify we can pre-flight a message size.""" dummy_frame[2] = Types.PING_REQ f = frame_rw.read(BytesIO(dummy_frame[2:]), size=len(dummy_frame)) message_rw = messages.RW[f.header.message_type] message_rw.read(BytesIO(f.payload)) == PingRequestMessage()