Skip to content

Commit bdf1cbb

Browse files
authored
Merge pull request #1715 from jku/tests-sim-updater-bootstrap
tests: Refactor client bootstrap
2 parents bc21225 + b34d1b4 commit bdf1cbb

3 files changed

+4
-12
lines changed

tests/test_updater_consistent_snapshot.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ def _init_repo(
5050

5151
# Init trusted root with the latest consistent_snapshot
5252
with open(os.path.join(self.metadata_dir, "root.json"), "bw") as f:
53-
root = sim.download_bytes(
54-
"https://example.com/metadata/2.root.json", 100000
55-
)
56-
f.write(root)
53+
f.write(sim.signed_roots[-1])
5754

5855
return sim
5956

tests/test_updater_top_level_update.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,9 @@ def setUp(self) -> None:
4949

5050
self.sim = RepositorySimulator()
5151

52+
# boostrap client with initial root metadata
5253
with open(os.path.join(self.metadata_dir, "root.json"), "bw") as f:
53-
root = self.sim.download_bytes(
54-
"https://example.com/metadata/1.root.json", 100000
55-
)
56-
f.write(root)
54+
f.write(self.sim.signed_roots[0])
5755

5856
def tearDown(self) -> None:
5957
self.temp_dir.cleanup()

tests/test_updater_with_simulator.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ def setUp(self) -> None:
3838
# Setup the repository, bootstrap client root.json
3939
self.sim = RepositorySimulator()
4040
with open(os.path.join(self.metadata_dir, "root.json"), "bw") as f:
41-
root = self.sim.download_bytes(
42-
"https://example.com/metadata/1.root.json", 100000
43-
)
44-
f.write(root)
41+
f.write(self.sim.signed_roots[0])
4542

4643
if self.dump_dir is not None:
4744
# create test specific dump directory

0 commit comments

Comments
 (0)