mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
tests: Add missing test to TrustedMetadataSet
Test failing length/hash test for snapshot Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
This commit is contained in:
parent
efb5653016
commit
85656a56eb
1 changed files with 10 additions and 0 deletions
|
|
@ -277,6 +277,16 @@ def timestamp_expired_modifier(timestamp: Timestamp) -> None:
|
|||
with self.assertRaises(exceptions.ExpiredMetadataError):
|
||||
self.trusted_set.update_timestamp(timestamp)
|
||||
|
||||
def test_update_snapshot_length_or_hash_mismatch(self):
|
||||
def modify_snapshot_length(timestamp: Timestamp) -> None:
|
||||
timestamp.meta["snapshot.json"].length = 1
|
||||
|
||||
# set known snapshot.json length to 1
|
||||
timestamp = self.modify_metadata("timestamp", modify_snapshot_length)
|
||||
self._root_updated_and_update_timestamp(timestamp)
|
||||
|
||||
with self.assertRaises(exceptions.RepositoryError):
|
||||
self.trusted_set.update_snapshot(self.metadata["snapshot"])
|
||||
|
||||
def test_update_snapshot_cannot_verify_snapshot_with_threshold(self):
|
||||
self._root_updated_and_update_timestamp(self.metadata["timestamp"])
|
||||
|
|
|
|||
Loading…
Reference in a new issue