Skip to content

Commit

Permalink
tests: Fill in more returned role name use
Browse files Browse the repository at this point in the history
Signed-off-by: William Woodruff <william@trailofbits.com>
  • Loading branch information
woodruffw committed Jun 1, 2020
1 parent 4327a98 commit 1e532e8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/test_repository_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1562,18 +1562,19 @@ def test_remove_target_from_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)
added_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 == added_rolename:
self.assertTrue('file1.txt' in delegation.target_files)
self.assertTrue(len(delegation.target_files) == 1)
else:
self.assertTrue('file1.txt' not in delegation.target_files)

# Test the remove_target_from_bin() method. Verify that 'target1_filepath'
# has been removed.
self.targets_object.remove_target_from_bin(target1_filepath, 16)
removed_rolename = self.targets_object.remove_target_from_bin(target1_filepath, 16)
self.assertEqual(added_rolename, removed_rolename)

for delegation in self.targets_object.delegations:
self.assertTrue(target1_filepath not in delegation.target_files)
Expand Down Expand Up @@ -1609,17 +1610,19 @@ def test_default_bin_num(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(os.path.basename(target1_filepath))
added_rolename = self.targets_object.add_target_to_bin(os.path.basename(target1_filepath))

for delegation in self.targets_object.delegations:
if delegation.rolename == '558-55b':
if delegation.rolename == added_rolename:
self.assertTrue('file1.txt' in delegation.target_files)

else:
self.assertFalse('file1.txt' in delegation.target_files)

# Remove target1_filepath and verify that all bins are now empty
self.targets_object.remove_target_from_bin(os.path.basename(target1_filepath))
removed_rolename = self.targets_object.remove_target_from_bin(
os.path.basename(target1_filepath))
self.assertEqual(added_rolename, removed_rolename)

for delegation in self.targets_object.delegations:
self.assertEqual(delegation.target_files, {})
Expand Down

0 comments on commit 1e532e8

Please sign in to comment.