From 22fa7f72a329683d910e200fc971da138366fee7 Mon Sep 17 00:00:00 2001 From: Vladimir Diaz Date: Fri, 20 Apr 2018 10:58:23 -0400 Subject: [PATCH] Modify URL comparison in test_arbitrary_package_attack.py Signed-off-by: Vladimir Diaz --- tests/test_arbitrary_package_attack.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/test_arbitrary_package_attack.py b/tests/test_arbitrary_package_attack.py index e808458c..f37abef4 100755 --- a/tests/test_arbitrary_package_attack.py +++ b/tests/test_arbitrary_package_attack.py @@ -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.')