Skip to content

Commit 36f0539

Browse files
committed
Update test_delegate_hashed_bins()
Test is updated to include checks for incorrect target paths. Signed-off-by: Teodora Sechkova <[email protected]>
1 parent 6079fc5 commit 36f0539

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

tests/test_repository_tool.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,13 +1452,18 @@ def check_prefixes_match_range():
14521452
list_of_targets, public_keys, number_of_bins=3)
14531453

14541454
# Invalid 'list_of_targets'.
1455-
# TODO
1456-
"""
1457-
invalid_targets = ['/non-existent']
1458-
self.assertRaises(securesystemslib.exceptions.Error,
1455+
# A path or target starting with a directory separator
1456+
self.assertRaises(tuf.exceptions.InvalidNameError,
1457+
self.targets_object.delegate_hashed_bins,
1458+
['/file1.txt'], public_keys,
1459+
number_of_bins=2)
1460+
1461+
# A path or target using '\' as a directory separator
1462+
self.assertRaises(tuf.exceptions.InvalidNameError,
14591463
self.targets_object.delegate_hashed_bins,
1460-
invalid_targets, public_keys, number_of_bins=16)
1461-
"""
1464+
['subpath\\file1.txt'], public_keys,
1465+
number_of_bins=2)
1466+
14621467

14631468
def test_add_target_to_bin(self):
14641469
# Test normal case.

0 commit comments

Comments
 (0)