()
| 116 | |
| 117 | |
| 118 | def test_packer(): |
| 119 | data = os.urandom(1024) |
| 120 | packer = salt.utils.msgpack.Packer() |
| 121 | unpacker = msgpack.Unpacker(None) |
| 122 | |
| 123 | packed = packer.pack(data) |
| 124 | # Sanity Check |
| 125 | assert packed |
| 126 | assert data != packed |
| 127 | |
| 128 | # Reverse the packing and the result should be equivalent to the original data |
| 129 | unpacker.feed(packed) |
| 130 | unpacked = msgpack.unpackb(packed) |
| 131 | assert data == unpacked |
| 132 | |
| 133 | |
| 134 | def test_unpacker(): |