Skip to content

Commit 9fe0808

Browse files
committed
Remove testing "update()" with "version" only
We have tests which make sure we can use `Timestamp.update()` and `Snapshot.update()` with MetaFile instance storing only version (because length and hashes are optional). Those tests were created to make sure that we are actually supporting optional hashes and length when we call `update` for those classes, but after we changed the `update()` signature to accept `MetaFile` instance the tests are obsolete. The reason is that length and hashes can be optional because of the MetaFile implementation, no the update function itself and we have other tests validating creating a MetaFie instance without hashes and length. Signed-off-by: Martin Vrachev <[email protected]>
1 parent a337051 commit 9fe0808

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

tests/test_api.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,6 @@ def test_metadata_snapshot(self):
306306
snapshot.signed.meta['role1.json'].to_dict(), fileinfo.to_dict()
307307
)
308308

309-
# Update only version. Length and hashes are optional.
310-
fileinfo = MetaFile(3)
311-
snapshot.signed.update('role2', fileinfo)
312-
self.assertEqual(
313-
snapshot.signed.meta['role2.json'].to_dict(), fileinfo.to_dict()
314-
)
315-
316309
# Test from_dict and to_dict without hashes and length.
317310
snapshot_dict = snapshot.to_dict()
318311
del snapshot_dict['signed']['meta']['role1.json']['length']
@@ -366,13 +359,6 @@ def test_metadata_timestamp(self):
366359
timestamp_test = Timestamp.from_dict(test_dict)
367360
self.assertEqual(timestamp_dict['signed'], timestamp_test.to_dict())
368361

369-
# Update only version. Length and hashes are optional.
370-
fileinfo = MetaFile(version=3)
371-
timestamp.signed.update(fileinfo)
372-
self.assertEqual(
373-
timestamp.signed.meta['snapshot.json'].to_dict(), fileinfo.to_dict()
374-
)
375-
376362
def test_key_class(self):
377363
keys = {
378364
"59a4df8af818e9ed7abe0764c0b47b4240952aa0d179b5b78346c470ac30278d":{

0 commit comments

Comments
 (0)