Skip to content

Commit 2117772

Browse files
author
Kairo de Araujo
committed
Removed RolesPayload data structure
The RolesPayload was used by the TUF initialization (for development purposes) and during the Roles Delegations. The RolesPayload is no longer necessary during the TUF development initialization once all the configuration is available on request settings. During the Roles Delegations, it was replaced by the python-TUF data structure DelegatedRole, reusing it from ``tuf.repository``. Signed-off-by: Kairo de Araujo <[email protected]>
1 parent 52b2508 commit 2117772

File tree

10 files changed

+257
-469
lines changed

10 files changed

+257
-469
lines changed

tests/conftest.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,14 +423,32 @@ def xmlrpc(self, path, method, *args):
423423

424424

425425
@pytest.fixture
426-
def tuf_repository():
426+
def tuf_repository(db_request):
427427
class FakeStorageBackend(StorageBackendInterface):
428428
pass
429429

430430
class FakeKeyBackend(IKeyService):
431431
pass
432432

433-
tuf_repo = MetadataRepository(FakeStorageBackend, FakeKeyBackend)
433+
db_request.registry.settings = {
434+
"tuf.keytype": "ed25519",
435+
"tuf.root.threshold": 1,
436+
"tuf.root.expiry": 31536000,
437+
"tuf.snapshot.threshold": 1,
438+
"tuf.snapshot.expiry": 86400,
439+
"tuf.targets.threshold": 2,
440+
"tuf.targets.expiry": 31536000,
441+
"tuf.timestamp.threshold": 1,
442+
"tuf.timestamp.expiry": 86400,
443+
"tuf.bins.threshold": 1,
444+
"tuf.bins.expiry": 31536000,
445+
"tuf.bin-n.threshold": 1,
446+
"tuf.bin-n.expiry": 604800,
447+
}
448+
449+
tuf_repo = MetadataRepository(
450+
FakeStorageBackend, FakeKeyBackend, db_request.registry.settings
451+
)
434452
return tuf_repo
435453

436454

tests/unit/cli/test_tuf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
add_hashed_targets as _add_hashed_targets,
2828
bump_bin_n_roles as _bump_bin_n_roles,
2929
bump_snapshot as _bump_snapshot,
30-
init_repository as _init_repository,
30+
init_dev_repository as _init_dev_repository,
3131
init_targets_delegation as _init_targets_delegation,
3232
)
3333

@@ -76,8 +76,8 @@ def test_init_repo(self, cli):
7676
assert result.exit_code == 0
7777
assert "Repository Initialization finished." in result.output
7878
assert config.task.calls == [
79-
pretend.call(_init_repository),
80-
pretend.call(_init_repository),
79+
pretend.call(_init_dev_repository),
80+
pretend.call(_init_dev_repository),
8181
]
8282
assert task.get_request.calls == [pretend.call()]
8383
assert task.run.calls == [pretend.call(request)]
@@ -96,8 +96,8 @@ def test_init_repo_raise_fileexistserror(self, cli):
9696
assert result.exit_code == 1
9797
assert "Error: TUF Error detail\n" == result.output
9898
assert config.task.calls == [
99-
pretend.call(_init_repository),
100-
pretend.call(_init_repository),
99+
pretend.call(_init_dev_repository),
100+
pretend.call(_init_dev_repository),
101101
]
102102
assert task.get_request.calls == [pretend.call()]
103103

0 commit comments

Comments
 (0)