Beispiel #1
0
 def test_repr(self):
     f = HeadersFrame(1)
     assert repr(f).endswith(
         "exclusive=False, depends_on=0, stream_weight=0, data=None")
     f.data = b'hello'
     f.exclusive = True
     f.depends_on = 42
     f.stream_weight = 64
     assert repr(f).endswith(
         "exclusive=True, depends_on=42, stream_weight=64, data=<hex:68656c6c6f>"
     )
Beispiel #2
0
    def test_headers_frame_with_priority_serializes_properly(self):
        # This test also tests that we can receive a HEADERS frame with no
        # actual headers on it. This is technically possible.
        s = (b'\x00\x00\x05\x01\x20\x00\x00\x00\x01' + b'\x80\x00\x00\x04\x40')
        f = HeadersFrame(1)
        f.flags = set(['PRIORITY'])
        f.data = b''
        f.depends_on = 4
        f.stream_weight = 64
        f.exclusive = True

        assert f.serialize() == s
    def test_headers_frame_with_priority_serializes_properly(self):
        # This test also tests that we can receive a HEADERS frame with no
        # actual headers on it. This is technically possible.
        s = (
            b'\x00\x00\x05\x01\x20\x00\x00\x00\x01' +
            b'\x80\x00\x00\x04\x40'
        )
        f = HeadersFrame(1)
        f.flags = set(['PRIORITY'])
        f.data = b''
        f.depends_on = 4
        f.stream_weight = 64
        f.exclusive = True

        assert f.serialize() == s