|
32 | 32 | Delegations,
|
33 | 33 | Key,
|
34 | 34 | Metadata,
|
35 |
| - MetaFile, |
36 | 35 | Root,
|
37 | 36 | Snapshot,
|
38 | 37 | TargetFile,
|
@@ -297,56 +296,6 @@ def test_metadata_base(self) -> None:
|
297 | 296 | with self.assertRaises(ValueError):
|
298 | 297 | Metadata.from_dict(data)
|
299 | 298 |
|
300 |
| - def test_metadata_snapshot(self) -> None: |
301 |
| - snapshot_path = os.path.join(self.repo_dir, "metadata", "snapshot.json") |
302 |
| - snapshot = Metadata[Snapshot].from_file(snapshot_path) |
303 |
| - |
304 |
| - # Create a MetaFile instance representing what we expect |
305 |
| - # the updated data to be. |
306 |
| - hashes = { |
307 |
| - "sha256": "c2986576f5fdfd43944e2b19e775453b96748ec4fe2638a6d2f32f1310967095" |
308 |
| - } |
309 |
| - fileinfo = MetaFile(2, 123, hashes) |
310 |
| - |
311 |
| - self.assertNotEqual( |
312 |
| - snapshot.signed.meta["role1.json"].to_dict(), fileinfo.to_dict() |
313 |
| - ) |
314 |
| - snapshot.signed.update("role1", fileinfo) |
315 |
| - self.assertEqual( |
316 |
| - snapshot.signed.meta["role1.json"].to_dict(), fileinfo.to_dict() |
317 |
| - ) |
318 |
| - |
319 |
| - def test_metadata_timestamp(self) -> None: |
320 |
| - timestamp_path = os.path.join( |
321 |
| - self.repo_dir, "metadata", "timestamp.json" |
322 |
| - ) |
323 |
| - timestamp = Metadata[Timestamp].from_file(timestamp_path) |
324 |
| - |
325 |
| - self.assertEqual(timestamp.signed.version, 1) |
326 |
| - timestamp.signed.bump_version() |
327 |
| - self.assertEqual(timestamp.signed.version, 2) |
328 |
| - |
329 |
| - self.assertEqual(timestamp.signed.expires, datetime(2030, 1, 1, 0, 0)) |
330 |
| - timestamp.signed.bump_expiration() |
331 |
| - self.assertEqual(timestamp.signed.expires, datetime(2030, 1, 2, 0, 0)) |
332 |
| - timestamp.signed.bump_expiration(timedelta(days=365)) |
333 |
| - self.assertEqual(timestamp.signed.expires, datetime(2031, 1, 2, 0, 0)) |
334 |
| - |
335 |
| - # Create a MetaFile instance representing what we expect |
336 |
| - # the updated data to be. |
337 |
| - hashes = { |
338 |
| - "sha256": "0ae9664468150a9aa1e7f11feecb32341658eb84292851367fea2da88e8a58dc" |
339 |
| - } |
340 |
| - fileinfo = MetaFile(2, 520, hashes) |
341 |
| - |
342 |
| - self.assertNotEqual( |
343 |
| - timestamp.signed.snapshot_meta.to_dict(), fileinfo.to_dict() |
344 |
| - ) |
345 |
| - timestamp.signed.update(fileinfo) |
346 |
| - self.assertEqual( |
347 |
| - timestamp.signed.snapshot_meta.to_dict(), fileinfo.to_dict() |
348 |
| - ) |
349 |
| - |
350 | 299 | def test_metadata_verify_delegate(self) -> None:
|
351 | 300 | root_path = os.path.join(self.repo_dir, "metadata", "root.json")
|
352 | 301 | root = Metadata[Root].from_file(root_path)
|
@@ -505,30 +454,6 @@ def test_is_target_in_pathpattern(self) -> None:
|
505 | 454 | DelegatedRole._is_target_in_pathpattern(targetpath, pathpattern)
|
506 | 455 | )
|
507 | 456 |
|
508 |
| - def test_metadata_targets(self) -> None: |
509 |
| - targets_path = os.path.join(self.repo_dir, "metadata", "targets.json") |
510 |
| - targets = Metadata[Targets].from_file(targets_path) |
511 |
| - |
512 |
| - # Create a fileinfo dict representing the expected updated data. |
513 |
| - filename = "file2.txt" |
514 |
| - hashes = { |
515 |
| - "sha256": "141f740f53781d1ca54b8a50af22cbf74e44c21a998fa2a8a05aaac2c002886b", |
516 |
| - "sha512": "ef5beafa16041bcdd2937140afebd485296cd54f7348ecd5a4d035c09759608de467a7ac0eb58753d0242df873c305e8bffad2454aa48f44480f15efae1cacd0", |
517 |
| - } |
518 |
| - |
519 |
| - fileinfo = TargetFile(length=28, hashes=hashes, path=filename) |
520 |
| - |
521 |
| - # Assert that data is not aleady equal |
522 |
| - self.assertNotEqual( |
523 |
| - targets.signed.targets[filename].to_dict(), fileinfo.to_dict() |
524 |
| - ) |
525 |
| - # Update an already existing fileinfo |
526 |
| - targets.signed.update(fileinfo) |
527 |
| - # Verify that data is updated |
528 |
| - self.assertEqual( |
529 |
| - targets.signed.targets[filename].to_dict(), fileinfo.to_dict() |
530 |
| - ) |
531 |
| - |
532 | 457 | def test_targets_key_api(self) -> None:
|
533 | 458 | targets_path = os.path.join(self.repo_dir, "metadata", "targets.json")
|
534 | 459 | targets: Targets = Metadata[Targets].from_file(targets_path).signed
|
|
0 commit comments