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:
Vladimir Diaz 2016-11-10 16:21:57 -05:00
parent cfaf865186
commit acf5bfddac

View file

@ -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)