mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Modify URL comparison in test_arbitrary_package_attack.py
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
This commit is contained in:
parent
ae8ffee57d
commit
22fa7f72a3
1 changed files with 8 additions and 6 deletions
|
|
@ -240,9 +240,10 @@ def test_with_tuf(self):
|
|||
|
||||
# Verify that the expected 'tuf.exceptions.DownloadLengthMismatchError' exception
|
||||
# is raised for 'url_file'.
|
||||
self.assertTrue(url_file in exception.mirror_errors)
|
||||
self.assertTrue(isinstance(exception.mirror_errors[url_file],
|
||||
securesystemslib.exceptions.BadHashError))
|
||||
self.assertTrue(url_file.replace('\\', '/') in exception.mirror_errors)
|
||||
self.assertTrue(
|
||||
isinstance(exception.mirror_errors[url_file.replace('\\', '/')],
|
||||
securesystemslib.exceptions.BadHashError))
|
||||
|
||||
else:
|
||||
self.fail('TUF did not prevent an arbitrary package attack.')
|
||||
|
|
@ -292,9 +293,10 @@ def test_with_tuf_and_metadata_tampering(self):
|
|||
self.assertTrue(len(exception.mirror_errors), 1)
|
||||
|
||||
# Verify that the specific and expected mirror exception is raised.
|
||||
self.assertTrue(url_file in exception.mirror_errors)
|
||||
self.assertTrue(isinstance(exception.mirror_errors[url_file],
|
||||
securesystemslib.exceptions.BadHashError))
|
||||
self.assertTrue(url_file.replace('\\', '/') in exception.mirror_errors)
|
||||
self.assertTrue(
|
||||
isinstance(exception.mirror_errors[url_file.replace('\\', '/')],
|
||||
securesystemslib.exceptions.BadHashError))
|
||||
|
||||
else:
|
||||
self.fail('TUF did not prevent an arbitrary package attack.')
|
||||
|
|
|
|||
Loading…
Reference in a new issue