From 717eef9bb5c255bdb3aec8edd995594c712a6ae5 Mon Sep 17 00:00:00 2001 From: Martin Vrachev Date: Fri, 8 Oct 2021 16:46:52 +0300 Subject: [PATCH] Repo simulator: make delegates() to all_targets() Modify RepositorySimulator function delegates() to all_targets(), so that all targets can be traversed and updated with one cycle when calling update_snapshot() (which is the only use case for now for delegates()). Signed-off-by: Martin Vrachev --- tests/repository_simulator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/repository_simulator.py b/tests/repository_simulator.py index 11edbc44..4bd43bba 100644 --- a/tests/repository_simulator.py +++ b/tests/repository_simulator.py @@ -124,7 +124,8 @@ def snapshot(self) -> Snapshot: def targets(self) -> Targets: return self.md_targets.signed - def delegates(self) -> Iterator[Tuple[str, Targets]]: + def all_targets(self) -> Iterator[Tuple[str, Targets]]: + yield "targets", self.md_targets.signed for role, md in self.md_delegates.items(): yield role, md.signed @@ -266,8 +267,7 @@ def update_timestamp(self): self.timestamp.version += 1 def update_snapshot(self): - self.snapshot.meta["targets.json"].version = self.targets.version - for role, delegate in self.delegates(): + for role, delegate in self.all_targets(): self.snapshot.meta[f"{role}.json"].version = delegate.version if self.compute_metafile_hashes_length: