MCPcopy
hub / github.com/borgbackup/borg / test_obfuscate_meta

Function test_obfuscate_meta

src/borg/testsuite/compress_test.py:170–186  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

168
169
170def test_obfuscate_meta():
171 compressor = CompressionSpec("obfuscate,3,lz4").compressor
172 data = bytes(10000)
173 meta, compressed = compressor.compress(dict(type=ROBJ_FILE_STREAM), data)
174 assert "ctype" in meta
175 assert meta["ctype"] == LZ4.ID
176 assert "clevel" in meta
177 assert meta["clevel"] == 0xFF
178 assert "csize" in meta
179 csize = meta["csize"]
180 assert csize == len(compressed) # this is the overall size
181 assert "psize" in meta
182 psize = meta["psize"]
183 assert 0 < psize < 100
184 assert csize - psize >= 0 # there is an obfuscation trailer
185 trailer = compressed[psize:]
186 assert not trailer or set(trailer) == {0} # trailer is all-zero-bytes
187
188
189@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 1

CompressionSpecClass · 0.85

Tested by

no test coverage detected