Skip to content

Commit

Permalink
remove roles names as str, snapshot order
Browse files Browse the repository at this point in the history
This commit removes the role names as strings. Also do a slight
change for clarity.

Signed-off-by: Kairo de Araujo <kdearaujo@vmware.com>
  • Loading branch information
Kairo de Araujo committed Dec 21, 2021
1 parent 8a8fff3 commit ac7a804
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions tests/test_updater_top_level_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,11 @@ def test_new_timestamp_fast_foward_recovery(self) -> None:
self._assert_version_equals(Timestamp.type, 99999)

# repo add new timestamp keys and recovers the timestamp version
self.sim.root.roles["timestamp"].keyids.clear()
self.sim.signers["timestamp"].clear()
self.sim.root.roles[Timestamp.type].keyids.clear()
self.sim.signers[Timestamp.type].clear()
key, signer = self.sim.create_key()
self.sim.root.add_key("timestamp", key)
self.sim.add_signer("timestamp", signer)
self.sim.root.add_key(Timestamp.type, key)
self.sim.add_signer(Timestamp.type, signer)
self.sim.root.version += 1
self.sim.publish_root()
self.sim.timestamp.version = 1
Expand Down Expand Up @@ -445,20 +445,20 @@ def test_new_snapshot_fast_foward_recovery(self) -> None:
self._assert_version_equals(Snapshot.type, 99999)

# repo add new snapshot and timestamp keys and recovers snapshot version
self.sim.root.roles["snapshot"].keyids.clear()
self.sim.signers["snapshot"].clear()
self.sim.root.roles["timestamp"].keyids.clear()
self.sim.signers["timestamp"].clear()
self.sim.root.roles[Snapshot.type].keyids.clear()
self.sim.signers[Snapshot.type].clear()
self.sim.root.roles[Timestamp.type].keyids.clear()
self.sim.signers[Timestamp.type].clear()
snapshot_key, snapshot_signer = self.sim.create_key()
self.sim.root.add_key("snapshot", snapshot_key)
self.sim.add_signer("snapshot", snapshot_signer)
self.sim.root.add_key(Snapshot.type, snapshot_key)
self.sim.add_signer(Snapshot.type, snapshot_signer)
timestamp_key, timestamp_signer = self.sim.create_key()
self.sim.root.add_key("timestamp", timestamp_key)
self.sim.add_signer("timestamp", timestamp_signer)
self.sim.snapshot.version = 1
self.sim.root.add_key(Timestamp.type, timestamp_key)
self.sim.add_signer(Timestamp.type, timestamp_signer)
self.sim.root.version += 1
self.sim.publish_root()

self.sim.snapshot.version = 1
self.sim.update_timestamp()

# client refresh the metadata and see the initial snapshot version
Expand Down Expand Up @@ -530,15 +530,15 @@ def test_compute_metafile_hashes_length(self) -> None:
self.sim.compute_metafile_hashes_length = True
self.sim.update_snapshot()
self._run_refresh()
self._assert_version_equals("timestamp", 2)
self._assert_version_equals("snapshot", 2)
self._assert_version_equals(Timestamp.type, 2)
self._assert_version_equals(Snapshot.type, 2)

self.sim.compute_metafile_hashes_length = False
self.sim.update_snapshot()
self._run_refresh()

self._assert_version_equals("timestamp", 3)
self._assert_version_equals("snapshot", 3)
self._assert_version_equals(Timestamp.type, 3)
self._assert_version_equals(Snapshot.type, 3)


if __name__ == "__main__":
Expand Down

0 comments on commit ac7a804

Please sign in to comment.