diff --git a/tests/test_repository_tool.py b/tests/test_repository_tool.py index 8da94a1e0c..c19f8d0af4 100755 --- a/tests/test_repository_tool.py +++ b/tests/test_repository_tool.py @@ -1374,10 +1374,13 @@ def test_delegate_hashed_bins(self): def check_prefixes_match_range(): roleinfo = tuf.roledb.get_roleinfo(self.targets_object.rolename, 'test_repository') + have_prefixes = False + for delegated_role in roleinfo['delegations']['roles']: if len(delegated_role['path_hash_prefixes']) > 0: rolename = delegated_role['name'] prefixes = delegated_role['path_hash_prefixes'] + have_prefixes = True if len(prefixes) > 1: prefix_range = "{}-{}".format(prefixes[0], prefixes[-1]) @@ -1386,6 +1389,8 @@ def check_prefixes_match_range(): self.assertEqual(rolename, prefix_range) + # We expect at least one delegation with some path_hash_prefixes + self.assertTrue(have_prefixes) # Test delegate_hashed_bins() and verify that 16 hashed bins have