-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: moved get threshold to the new repository class, implement dele…
…gated role lookup
- Loading branch information
Showing
5 changed files
with
169 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import pytest | ||
from taf.exceptions import TAFError | ||
from taf.tests.conftest import TEST_DATA_REPOS_PATH | ||
from taf.tuf.repository import MetadataRepository | ||
|
||
def test_get_threshold_no_delegations(): | ||
test_group_dir = TEST_DATA_REPOS_PATH / "test-repository-tool/test-happy-path-pkcs1v15" / "taf" | ||
tuf_repo = MetadataRepository(test_group_dir) | ||
assert tuf_repo.get_role_threshold("root") == 2 | ||
assert tuf_repo.get_role_threshold("targets") == 1 | ||
assert tuf_repo.get_role_threshold("snapshot") == 1 | ||
assert tuf_repo.get_role_threshold("timestamp") == 1 | ||
with pytest.raises(TAFError): | ||
tuf_repo.get_role_threshold("doestexist") | ||
|
||
def test_get_threshold_delegations(): | ||
test_group_dir = TEST_DATA_REPOS_PATH / "test-repository-tool/test-delegated-roles-pkcs1v15" / "taf" | ||
tuf_repo = MetadataRepository(test_group_dir) | ||
assert tuf_repo.get_role_threshold("delegated_role1") == 2 | ||
assert tuf_repo.get_role_threshold("delegated_role2") == 1 | ||
assert tuf_repo.get_role_threshold("inner_delegated_role") == 1 | ||
|
||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters