Esempio n. 1
0
    def test_ping_frame_serializes_properly(self):
        f = PingFrame(0)
        f.parse_flags(0xFF)
        f.opaque_data = b"\x01\x02"

        s = f.serialize()
        assert s == (b"\x00\x08\x06\x01\x00\x00\x00\x00\x01\x02\x00\x00\x00\x00\x00\x00")
Esempio n. 2
0
    def test_ping_frame_serializes_properly(self):
        f = PingFrame(0)
        f.parse_flags(0xFF)
        f.opaque_data = b'\x01\x02'

        s = f.serialize()
        assert s == (
            b'\x00\x08\x06\x01\x00\x00\x00\x00\x01\x02\x00\x00\x00\x00\x00\x00'
        )
Esempio n. 3
0
    def test_no_more_than_8_octets(self):
        f = PingFrame(0)
        f.opaque_data = b'\x01\x02\x03\x04\x05\x06\x07\x08\x09'

        with pytest.raises(ValueError):
            f.serialize()
Esempio n. 4
0
    def test_ping_frame_has_only_one_flag(self):
        f = PingFrame(0)
        flags = f.parse_flags(0xFF)

        assert flags == set(['ACK'])
Esempio n. 5
0
    def test_no_more_than_8_octets(self):
        f = PingFrame(0)
        f.opaque_data = b'\x01\x02\x03\x04\x05\x06\x07\x08\x09'

        with pytest.raises(ValueError):
            f.serialize()
Esempio n. 6
0
    def test_ping_frame_has_only_one_flag(self):
        f = PingFrame(0)
        flags = f.parse_flags(0xFF)

        assert flags == set(['ACK'])
Esempio n. 7
0
 def test_ping_frame_has_no_more_than_body_length_8(self):
     f = PingFrame(0)
     with pytest.raises(ValueError):
         f.parse_body(b'\x01\x02\x03\x04\x05\x06\x07\x08\x09')
Esempio n. 8
0
 def test_ping_frame_never_has_a_stream(self):
     with pytest.raises(ValueError):
         PingFrame(1)
Esempio n. 9
0
 def test_ping_frame_has_no_more_than_body_length_8(self):
     f = PingFrame(0)
     with pytest.raises(ValueError):
         f.parse_body(b"\x01\x02\x03\x04\x05\x06\x07\x08\x09")