Merge pull request #1715 from jku/tests-sim-updater-bootstrap

tests: Refactor client bootstrap
This commit is contained in:
Teodora Sechkova 2021-12-10 13:06:53 +02:00 committed by GitHub
commit bdf1cbbbb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 12 deletions

View file

@ -50,10 +50,7 @@ def _init_repo(
# Init trusted root with the latest consistent_snapshot
with open(os.path.join(self.metadata_dir, "root.json"), "bw") as f:
root = sim.download_bytes(
"https://example.com/metadata/2.root.json", 100000
)
f.write(root)
f.write(sim.signed_roots[-1])
return sim

View file

@ -49,11 +49,9 @@ def setUp(self) -> None:
self.sim = RepositorySimulator()
# boostrap client with initial root metadata
with open(os.path.join(self.metadata_dir, "root.json"), "bw") as f:
root = self.sim.download_bytes(
"https://example.com/metadata/1.root.json", 100000
)
f.write(root)
f.write(self.sim.signed_roots[0])
def tearDown(self) -> None:
self.temp_dir.cleanup()

View file

@ -38,10 +38,7 @@ def setUp(self) -> None:
# Setup the repository, bootstrap client root.json
self.sim = RepositorySimulator()
with open(os.path.join(self.metadata_dir, "root.json"), "bw") as f:
root = self.sim.download_bytes(
"https://example.com/metadata/1.root.json", 100000
)
f.write(root)
f.write(self.sim.signed_roots[0])
if self.dump_dir is not None:
# create test specific dump directory