def test_pack_binary(self): bin_body = "\x00\x00HELLO\x00\x00DONKEY\x00\x00" frame = Frame(frames.CONNECT, body=bin_body) self.assertEqual(frame.pack( ), b'CONNECT\ncontent-length:17\n\n\x00\x00HELLO\x00\x00DONKEY\x00\x00\x00')
def test_pack(self): frame = Frame(frames.CONNECT, OrderedDict(foo='bar'), 'body') self.assertEqual( frame.pack(), b'CONNECT\nfoo:bar\ncontent-length:4\n\nbody\x00')