From c941eda8d2fe16ed9d608ffadf260dd28b464c83 Mon Sep 17 00:00:00 2001 From: zanefisher Date: Fri, 4 Oct 2013 14:00:36 -0400 Subject: [PATCH] Changes following Santiago\'s review. --- tests/integration/test_arbitrary_package_attack.py | 12 ++++++++++-- .../test_extraneous_dependencies_attack.py | 14 ++++++++++---- tuf/tests/util_test_tools.py | 2 +- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/tests/integration/test_arbitrary_package_attack.py b/tests/integration/test_arbitrary_package_attack.py index 8494ce2c..9b10f30b 100755 --- a/tests/integration/test_arbitrary_package_attack.py +++ b/tests/integration/test_arbitrary_package_attack.py @@ -29,6 +29,13 @@ """ +# Help with Python 3 compatability, where the print statement is a function, an +# implicit relative import is invalid, and the '/' operator performs true +# division. Example: print 'hello world' raises a 'SyntaxError' exception. +from __future__ import print_function +from __future__ import absolute_import +from __future__ import division + import os import urllib @@ -121,7 +128,7 @@ def test_arbitrary_package_attack(using_tuf=False, modify_metadata=False): release_metadata_filepath, release_metadata_key_list) - # Modify timestamp metadata to reflect he change to release metadata. + # Modify timestamp metadata to reflect the change to release metadata. timestamp_metadata_filepath = os.path.join(tuf_repo, 'metadata', 'timestamp.txt') @@ -192,7 +199,8 @@ def test_arbitrary_package_attack(using_tuf=False, modify_metadata=False): print() -print('Attempting arbitrary package attack with TUF (and tampering with metadata):') +print('Attempting arbitrary package attack with TUF'+\ + '(and tampering with metadata):') try: test_arbitrary_package_attack(using_tuf=True, modify_metadata=True) except ArbitraryPackageAlert, error: diff --git a/tests/integration/test_extraneous_dependencies_attack.py b/tests/integration/test_extraneous_dependencies_attack.py index 14e49eea..3bd34c0b 100755 --- a/tests/integration/test_extraneous_dependencies_attack.py +++ b/tests/integration/test_extraneous_dependencies_attack.py @@ -36,6 +36,12 @@ """ +# Help with Python 3 compatability, where the print statement is a function, an +# implicit relative import is invalid, and the '/' operator performs true +# division. Example: print 'hello world' raises a 'SyntaxError' exception. +from __future__ import print_function +from __future__ import absolute_import +from __future__ import division import os import urllib @@ -160,7 +166,7 @@ def test_extraneous_dependency_attack(using_tuf=False, modify_metadata=False): release_metadata_filepath, release_metadata_key_list) - # Modify timestamp metadata to reflect he change to release metadata. + # Modify timestamp metadata to reflect the change to release metadata. timestamp_metadata_filepath = os.path.join(tuf_repo, 'metadata', 'timestamp.txt') @@ -237,12 +243,12 @@ def test_extraneous_dependency_attack(using_tuf=False, modify_metadata=False): print() -print('Attempting extraneous dependency attack with TUF\ - (and tampering with metadata):') +print('Attempting extraneous dependency attack with TUF'+\ + '(and tampering with metadata):') try: test_extraneous_dependency_attack(using_tuf=True, modify_metadata=True) except ExtraneousDependencyAlert, error: - print(error + print(error) else: print('Extraneous dependency attack failed.') print() diff --git a/tuf/tests/util_test_tools.py b/tuf/tests/util_test_tools.py index 53a3f463..f118bad6 100644 --- a/tuf/tests/util_test_tools.py +++ b/tuf/tests/util_test_tools.py @@ -630,7 +630,7 @@ def update_signed_file_in_metadata(signee_filepath, signer_filepath, signer_filepath: filepath of the metadata that signs the modified file lookup_keys: - a list of the keys used to look up signee's file info in signer + a list of the DICTIONARY keys used to look up signee's file info in signer """ signer_file = open(signer_filepath, 'r+')