Update test cases for modified behavior when delegating paths

Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
This commit is contained in:
Vladimir Diaz 2018-01-03 16:12:28 -05:00
parent 7de7026efe
commit a977ccc355
No known key found for this signature in database
GPG key ID: 5DEE9B97B0E2289A

View file

@ -1208,10 +1208,10 @@ def test_delegate(self):
path_hash_prefixes=path_hash_prefixes)
# Test for targets that do not exist under the targets directory.
self.assertRaises(securesystemslib.exceptions.Error, self.targets_object.delegate, rolename,
public_keys, list_of_targets, threshold,
terminating=False, restricted_paths=['non-existent.txt'],
path_hash_prefixes=path_hash_prefixes)
# An exception should be raised for non-existent delegated paths.
self.targets_object.delegate(rolename, public_keys, list_of_targets,
threshold, terminating=False, restricted_paths=['non-existent.txt'],
path_hash_prefixes=path_hash_prefixes)
# Test improperly formatted arguments.
@ -1494,14 +1494,14 @@ def test_add_restricted_paths(self):
self.targets_object.add_restricted_paths, restricted_paths,
'non_delegated_rolename')
# Non-existent 'restricted_paths'.
self.assertRaises(securesystemslib.exceptions.Error,
self.targets_object.add_restricted_paths, ['/non-existent'], 'tuf')
# add_restricted_paths() should not raise an exception for non-existent
# paths, which is previously did.
self.targets_object.add_restricted_paths(['/non-existent'], 'tuf')
# Directory not under the repository's targets directory.
# add_restricted_paths() should not raise an exception for directories that
# do not fall under the repository's targets directory.
repository_directory = os.path.join('repository_data', 'repository')
self.assertRaises(securesystemslib.exceptions.Error,
self.targets_object.add_restricted_paths, [repository_directory], 'tuf')
self.targets_object.add_restricted_paths([repository_directory], 'tuf')