Skip to content

Commit

Permalink
update tests so that keyids do not have to be verified
Browse files Browse the repository at this point in the history
Signed-off-by: marinamoore <[email protected]>
  • Loading branch information
mnm678 committed Jul 23, 2020
1 parent c84ffaf commit 3c78d67
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/test_keydb.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,16 @@ def test_create_keydb_from_root_metadata(self):

# Ensure only 'keyid2' was added to the keydb database. 'keyid' and
# 'keyid3' should not be stored.
self.maxDiff = None
self.assertEqual(rsakey2, tuf.keydb.get_key(keyid2))
self.assertRaises(tuf.exceptions.UnknownKeyError, tuf.keydb.get_key, keyid)

test_key = rsakey2
test_key['keyid'] = keyid
self.assertEqual(test_key, tuf.keydb.get_key(keyid))
self.assertRaises(tuf.exceptions.UnknownKeyError, tuf.keydb.get_key, keyid3)

rsakey3['keytype'] = 'rsa'
rsakey2['keyid'] = keyid2



Expand Down

2 comments on commit 3c78d67

@lorenzo-blasa
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been a while since these changes got integrated but I do have a question:
Line 393 is getting removed in favour of 397 without changing the internal key database.

Without getting the most recent TUF dependency, and locally running unit tests, that unit test fails as it raises the UnknownKeyError.

If I pull the latest of everything, then everything seems to work. But I cannot see from this commit how the test changed.

Thanks!

@mnm678
Copy link
Contributor Author

@mnm678 mnm678 commented on 3c78d67 Feb 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was part of a pr to remove keyid_hash_algorithms. As part of that pr, TUF no longer re-computes keyids, but instead uses keyids provided by TUF metadata. Because of this change, a keyid calculated differently will be accepted and not cause an UnknownKeyError.

This test could probably use a better explanatory comment, feel free to open an issue.

Please sign in to comment.