1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-29 11:16:43 +00:00

fix byte range error in test, fixes #1740

This commit is contained in:
Thomas Waldmann 2016-10-19 17:38:30 +02:00
parent 64d128cf22
commit e02d1a66b8

View file

@ -155,7 +155,7 @@ def test_passphrase(self, keys_dir, monkeypatch):
def _corrupt_byte(self, key, data, offset): def _corrupt_byte(self, key, data, offset):
data = bytearray(data) data = bytearray(data)
data[offset] += 1 data[offset] ^= 1
with pytest.raises(IntegrityError): with pytest.raises(IntegrityError):
key.decrypt(b'', data) key.decrypt(b'', data)
@ -186,7 +186,7 @@ def test_assert_id(self, key):
id = key.id_hash(plaintext) id = key.id_hash(plaintext)
key.assert_id(id, plaintext) key.assert_id(id, plaintext)
id_changed = bytearray(id) id_changed = bytearray(id)
id_changed[0] += 1 id_changed[0] ^= 1
with pytest.raises(IntegrityError): with pytest.raises(IntegrityError):
key.assert_id(id_changed, plaintext) key.assert_id(id_changed, plaintext)
plaintext_changed = plaintext + b'1' plaintext_changed = plaintext + b'1'