From ac7a804525f41db3c1f1872f27d57ee9986ba0ee Mon Sep 17 00:00:00 2001 From: Kairo de Araujo Date: Tue, 21 Dec 2021 14:35:33 +0100 Subject: [PATCH] remove roles names as str, snapshot order This commit removes the role names as strings. Also do a slight change for clarity. Signed-off-by: Kairo de Araujo --- tests/test_updater_top_level_update.py | 34 +++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/test_updater_top_level_update.py b/tests/test_updater_top_level_update.py index bde9c11cc0..ed5a96d5ec 100644 --- a/tests/test_updater_top_level_update.py +++ b/tests/test_updater_top_level_update.py @@ -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 @@ -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 @@ -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__":