mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Add coverage for _delete_obsolete_metadata()
This function was recently updated to ignore root.json (and continue). Add coverage for it now
This commit is contained in:
parent
cfaf865186
commit
acf5bfddac
1 changed files with 11 additions and 2 deletions
|
|
@ -990,8 +990,17 @@ def test__delete_obsolete_metadata(self):
|
|||
snapshot_signable['signed'],
|
||||
True)
|
||||
|
||||
# Verify what happens for a non-existent metadata directory (a debug message
|
||||
# is logged).
|
||||
# _delete_obsolete_metadata should never delete root.json.
|
||||
root_filepath = os.path.join('repository_data', 'repository',
|
||||
'metadata', 'root.json')
|
||||
shutil.copyfile(root_filepath, os.path.join(metadata_directory, 'root.json'))
|
||||
repo_lib._delete_obsolete_metadata(metadata_directory,
|
||||
snapshot_signable['signed'],
|
||||
True)
|
||||
self.assertTrue(os.path.exists(os.path.join(metadata_directory, 'root.json')))
|
||||
|
||||
# Verify what happens for a non-existent metadata directory (a debug
|
||||
# message is logged).
|
||||
repo_lib._delete_obsolete_metadata('non-existent',
|
||||
snapshot_signable['signed'],
|
||||
True)
|
||||
|
|
|
|||
Loading…
Reference in a new issue