Пример #1
0
    def test_serialize(self):
        promise_frame = PushPromise(stream_id=1, flags={SpecialFrameFlag.END_PUSH_PROMISE})
        promise_frame.deserialize(self.test_promise_payload)

        frame_bytes = promise_frame.serialize()

        self.assertEqual(b'\x00\x12\x05\x04\x00\x00\x00\x01\x00\x00\x11\x5cpromised stuff', frame_bytes)
Пример #2
0
    def test_deserialize(self):
        promise_frame = PushPromise(stream_id=1)
        promise_frame.deserialize(self.test_promise_payload)

        self.assertEqual(promise_frame.promised_stream_id, 4444)
        self.assertEqual(promise_frame.data, b'promised stuff')