예제 #1
0
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()
예제 #2
0
def test_decode_empty_buffer():
    """Verify we can parse zero size frame."""
    assert frame_rw.read(BytesIO(b'\x00\x00\x00\x00')) is None
예제 #3
0
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()
예제 #4
0
def test_decode_empty_buffer():
    """Verify we can parse zero size frame."""
    assert frame_rw.read(BytesIO(b'\x00\x00\x00\x00')) is None