Skip to content

Commit

Permalink
Removed RolesPayload data structure
Browse files Browse the repository at this point in the history
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 <kdearaujo@vmware.com>
  • Loading branch information
Kairo de Araujo committed May 24, 2022
1 parent 8f8b7fc commit 428d8e7
Show file tree
Hide file tree
Showing 10 changed files with 257 additions and 469 deletions.
22 changes: 20 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,32 @@ def xmlrpc(self, path, method, *args):


@pytest.fixture
def tuf_repository():
def tuf_repository(db_request):
class FakeStorageBackend(StorageBackendInterface):
pass

class FakeKeyBackend(IKeyService):
pass

tuf_repo = MetadataRepository(FakeStorageBackend, FakeKeyBackend)
db_request.registry.settings = {
"tuf.keytype": "ed25519",
"tuf.root.threshold": 1,
"tuf.root.expiry": 31536000,
"tuf.snapshot.threshold": 1,
"tuf.snapshot.expiry": 86400,
"tuf.targets.threshold": 2,
"tuf.targets.expiry": 31536000,
"tuf.timestamp.threshold": 1,
"tuf.timestamp.expiry": 86400,
"tuf.bins.threshold": 1,
"tuf.bins.expiry": 31536000,
"tuf.bin-n.threshold": 1,
"tuf.bin-n.expiry": 604800,
}

tuf_repo = MetadataRepository(
FakeStorageBackend, FakeKeyBackend, db_request.registry.settings
)
return tuf_repo


Expand Down
10 changes: 5 additions & 5 deletions tests/unit/cli/test_tuf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
add_hashed_targets as _add_hashed_targets,
bump_bin_n_roles as _bump_bin_n_roles,
bump_snapshot as _bump_snapshot,
init_repository as _init_repository,
init_dev_repository as _init_dev_repository,
init_targets_delegation as _init_targets_delegation,
)

Expand Down Expand Up @@ -76,8 +76,8 @@ def test_init_repo(self, cli):
assert result.exit_code == 0
assert "Repository Initialization finished." in result.output
assert config.task.calls == [
pretend.call(_init_repository),
pretend.call(_init_repository),
pretend.call(_init_dev_repository),
pretend.call(_init_dev_repository),
]
assert task.get_request.calls == [pretend.call()]
assert task.run.calls == [pretend.call(request)]
Expand All @@ -96,8 +96,8 @@ def test_init_repo_raise_fileexistserror(self, cli):
assert result.exit_code == 1
assert "Error: TUF Error detail\n" == result.output
assert config.task.calls == [
pretend.call(_init_repository),
pretend.call(_init_repository),
pretend.call(_init_dev_repository),
pretend.call(_init_dev_repository),
]
assert task.get_request.calls == [pretend.call()]

Expand Down
Loading

0 comments on commit 428d8e7

Please sign in to comment.