Verify non-None role name supplied to tuf.sig.get_signature_status()

This commit is contained in:
Vladimir Diaz 2016-07-01 13:26:46 -04:00
parent 5c7333b062
commit e072cd9961
3 changed files with 3 additions and 4 deletions

View file

@ -57,7 +57,6 @@ def tearDown(self):
def test_create_roledb(self):
# Verify that a roledb is created for a named repository.
print('roledb: ' + repr(tuf.roledb._roledb_dict))
self.assertEqual(1, len(tuf.roledb._roledb_dict))
self.assertTrue('default' in tuf.roledb._roledb_dict)

View file

@ -1075,8 +1075,6 @@ def test_6_download_target(self):
# 'download_targetfileinfo' object being tested.
if 'custom' in target_fileinfo['fileinfo']:
download_targetfileinfo['custom'] = target_fileinfo['fileinfo']['custom']
print('target_fileinfo: ' + repr(target_fileinfo['fileinfo']))
print('\ndownload_targetfileinfo: ' + repr(download_targetfileinfo))
self.assertEqual(target_fileinfo['fileinfo'], download_targetfileinfo)

View file

@ -97,9 +97,11 @@ def get_signature_status(signable, role=None, repository_name='default'):
# all dict keys are properly named. Raise 'tuf.FormatError' if the check
# fails.
tuf.formats.SIGNABLE_SCHEMA.check_match(signable)
tuf.formats.ROLENAME_SCHEMA.check_match(role)
tuf.formats.NAME_SCHEMA.check_match(repository_name)
if role is not None:
tuf.formats.ROLENAME_SCHEMA.check_match(role)
# The signature status dictionary returned.
signature_status = {}