Skip to content

Commit

Permalink
tests: Use newly returned role name
Browse files Browse the repository at this point in the history
Signed-off-by: William Woodruff <[email protected]>
  • Loading branch information
woodruffw committed Jun 1, 2020
1 parent 65fd02c commit 4327a98
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/test_repository_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1495,10 +1495,10 @@ def test_add_target_to_bin(self):

# Add 'target1_filepath' and verify that the relative path of
# 'target1_filepath' is added to the correct bin.
self.targets_object.add_target_to_bin(target1_filepath, 16)
rolename = self.targets_object.add_target_to_bin(target1_filepath, 16)

for delegation in self.targets_object.delegations:
if delegation.rolename == '5':
if delegation.rolename == rolename:
self.assertTrue('file1.txt' in delegation.target_files)

else:
Expand All @@ -1513,7 +1513,7 @@ def test_add_target_to_bin(self):
target1_filepath, 16)

# Test for a required hashed bin that does not exist.
self.targets_object.revoke('5')
self.targets_object.revoke(rolename)
self.assertRaises(securesystemslib.exceptions.Error,
self.targets_object.add_target_to_bin,
target1_filepath, 16)
Expand All @@ -1523,10 +1523,11 @@ def test_add_target_to_bin(self):
target2_fileinfo = tuf.formats.make_fileinfo(37, target2_hashes)
target2_filepath = 'file2.txt'

self.targets_object.add_target_to_bin(target2_filepath, 16, fileinfo=target2_fileinfo)
rolename = self.targets_object.add_target_to_bin(target2_filepath, 16,
fileinfo=target2_fileinfo)

for delegation in self.targets_object.delegations:
if delegation.rolename == '0':
if delegation.rolename == rolename:
self.assertTrue(target2_filepath in delegation.target_files)

else:
Expand Down

0 comments on commit 4327a98

Please sign in to comment.