change global compression default to lz4 as well

To be consistent with --compression defaults.
This commit is contained in:
Marian Beermann 2017-04-03 21:25:39 +02:00
parent 0847c3f9a5
commit 929f2760dd
2 changed files with 6 additions and 3 deletions

View file

@ -142,7 +142,9 @@ class KeyBase:
self.TYPE_STR = bytes([self.TYPE])
self.repository = repository
self.target = None # key location file path / repo obj
self.compressor = Compressor('none') # for decompression
# Some commands write new chunks (e.g. rename) but don't take a --compression argument. This duplicates
# the default used by those commands who do take a --compression argument.
self.compressor = Compressor('lz4')
self.decompress = self.compressor.decompress
self.tam_required = True

View file

@ -246,8 +246,9 @@ class TestKey:
key = AuthenticatedKey.create(self.MockRepository(), self.MockArgs())
plaintext = Chunk(b'123456789')
authenticated = key.encrypt(plaintext)
# 0x06 is the key TYPE, 0x0000 identifies CNONE compression
assert authenticated == b'\x06\x00\x00' + plaintext.data
# 0x06 is the key TYPE, 0x0100 identifies LZ4 compression, 0x90 is part of LZ4 and means that an uncompressed
# block of length nine follows (the plaintext).
assert authenticated == b'\x06\x01\x00\x90' + plaintext.data
class TestPassphrase: