diff --git a/docs/CONTRIBUTORS.rst b/docs/CONTRIBUTORS.rst index 54ef8a8d..2ab205b2 100644 --- a/docs/CONTRIBUTORS.rst +++ b/docs/CONTRIBUTORS.rst @@ -139,9 +139,9 @@ Individual tests can also be executed. Optional '-v' flags can be added to increase log level up to DEBUG ('-vvvv'). :: - $ python3 test_updater.py # run a specific test file - $ python3 test_updater.py TestUpdater.test_4_refresh # run a specific test - $ python3 test_updater.py -vvvv TestUpdater.test_4_refresh # run test with DEBUG log level + $ python3 test_updater_ng.py # run a specific test file + $ python3 test_updater_ng.py TestUpdater.test_refresh_and_download # run a specific test + $ python3 test_updater_ng.py -vvvv TestUpdater.test_refresh_and_download # run test with DEBUG log level All of the log levels and the corresponding options that could be used for testing are: diff --git a/tests/fast_server_exit.py b/tests/fast_server_exit_old.py similarity index 100% rename from tests/fast_server_exit.py rename to tests/fast_server_exit_old.py diff --git a/tests/repository_data/generate.py b/tests/repository_data/generate_old.py similarity index 100% rename from tests/repository_data/generate.py rename to tests/repository_data/generate_old.py diff --git a/tests/repository_data/generate_project_data.py b/tests/repository_data/generate_project_data_old.py similarity index 97% rename from tests/repository_data/generate_project_data.py rename to tests/repository_data/generate_project_data_old.py index fc93fd59..db3d00df 100755 --- a/tests/repository_data/generate_project_data.py +++ b/tests/repository_data/generate_project_data_old.py @@ -17,8 +17,8 @@ See LICENSE-MIT.txt OR LICENSE-APACHE.txt for licensing information. - Generate a pre-fabricated set of metadata files for 'test_developer_tool.py' - test cases. + Generate a pre-fabricated set of metadata files for + 'test_developer_tool_old.py' test cases. """ import shutil diff --git a/tests/simple_https_server.py b/tests/simple_https_server_old.py similarity index 93% rename from tests/simple_https_server.py rename to tests/simple_https_server_old.py index 68d0512f..bf29d0da 100755 --- a/tests/simple_https_server.py +++ b/tests/simple_https_server_old.py @@ -5,7 +5,7 @@ """ - simple_https_server.py + simple_https_server_old.py Vladimir Diaz. @@ -53,7 +53,7 @@ print(port_message) if len(sys.argv) > 1 and certfile != sys.argv[1]: - print('simple_https_server: cert file was not found: ' + sys.argv[1] + + print('simple_https_server_old: cert file was not found: ' + sys.argv[1] + '; using default: ' + certfile + " certfile") httpd.serve_forever() diff --git a/tests/slow_retrieval_server.py b/tests/slow_retrieval_server_old.py similarity index 96% rename from tests/slow_retrieval_server.py rename to tests/slow_retrieval_server_old.py index bac904f2..c2586f2e 100755 --- a/tests/slow_retrieval_server.py +++ b/tests/slow_retrieval_server_old.py @@ -5,7 +5,7 @@ """ - slow_retrieval_server.py + slow_retrieval_server_old.py Konstantin Andrianov. @@ -18,7 +18,7 @@ Server that throttles data by sending one byte at a time (specified time - interval 'DELAY'). The server is used in 'test_slow_retrieval_attack.py'. + interval 'DELAY'). The server is used in 'test_slow_retrieval_attack_old.py'. """ import os diff --git a/tests/test_arbitrary_package_attack.py b/tests/test_arbitrary_package_attack_old.py similarity index 99% rename from tests/test_arbitrary_package_attack.py rename to tests/test_arbitrary_package_attack_old.py index 02b4c249..07917512 100755 --- a/tests/test_arbitrary_package_attack.py +++ b/tests/test_arbitrary_package_attack_old.py @@ -5,7 +5,7 @@ """ - test_arbitrary_package_attack.py + test_arbitrary_package_attack_old.py Konstantin Andrianov. diff --git a/tests/test_developer_tool.py b/tests/test_developer_tool_old.py similarity index 99% rename from tests/test_developer_tool.py rename to tests/test_developer_tool_old.py index d0669644..bec0d62e 100755 --- a/tests/test_developer_tool.py +++ b/tests/test_developer_tool_old.py @@ -5,7 +5,7 @@ """ - test_developer_tool.py. + test_developer_tool_old.py. Santiago Torres Arias diff --git a/tests/test_download.py b/tests/test_download_old.py similarity index 98% rename from tests/test_download.py rename to tests/test_download_old.py index 3b4572cc..4af22738 100755 --- a/tests/test_download.py +++ b/tests/test_download_old.py @@ -5,7 +5,7 @@ """ - test_download.py + test_download_old.py Konstantin Andrianov. @@ -19,7 +19,7 @@ Unit test for 'download.py'. - NOTE: Make sure test_download.py is ran in 'tuf/tests/' directory. + NOTE: Make sure test_download_old.py is ran in 'tuf/tests/' directory. Otherwise, module that launches simple server would not be found. TODO: Adopt the environment variable management from test_proxy_use.py here. @@ -274,16 +274,16 @@ def test_https_connection(self): good_https_server_handler = utils.TestServerProcess(log=logger, - server='simple_https_server.py', + server='simple_https_server_old.py', extra_cmd_args=[good_cert_fname]) good2_https_server_handler = utils.TestServerProcess(log=logger, - server='simple_https_server.py', + server='simple_https_server_old.py', extra_cmd_args=[good2_cert_fname]) bad_https_server_handler = utils.TestServerProcess(log=logger, - server='simple_https_server.py', + server='simple_https_server_old.py', extra_cmd_args=[bad_cert_fname]) expd_https_server_handler = utils.TestServerProcess(log=logger, - server='simple_https_server.py', + server='simple_https_server_old.py', extra_cmd_args=[expired_cert_fname]) suffix = '/' + os.path.basename(target_filepath) diff --git a/tests/test_endless_data_attack.py b/tests/test_endless_data_attack_old.py similarity index 99% rename from tests/test_endless_data_attack.py rename to tests/test_endless_data_attack_old.py index 251379bb..aafed1a2 100755 --- a/tests/test_endless_data_attack.py +++ b/tests/test_endless_data_attack_old.py @@ -5,7 +5,7 @@ """ - test_endless_data_attack.py + test_endless_data_attack_old.py Konstantin Andrianov. diff --git a/tests/test_extraneous_dependencies_attack.py b/tests/test_extraneous_dependencies_attack_old.py similarity index 99% rename from tests/test_extraneous_dependencies_attack.py rename to tests/test_extraneous_dependencies_attack_old.py index 7e2bff73..f086e7e8 100755 --- a/tests/test_extraneous_dependencies_attack.py +++ b/tests/test_extraneous_dependencies_attack_old.py @@ -5,7 +5,7 @@ """ - test_extraneous_dependencies_attack.py + test_extraneous_dependencies_attack_old.py Zane Fisher. diff --git a/tests/test_fetcher.py b/tests/test_fetcher_old.py similarity index 100% rename from tests/test_fetcher.py rename to tests/test_fetcher_old.py diff --git a/tests/test_formats.py b/tests/test_formats_old.py similarity index 99% rename from tests/test_formats.py rename to tests/test_formats_old.py index 96da912b..498be2d1 100755 --- a/tests/test_formats.py +++ b/tests/test_formats_old.py @@ -5,7 +5,7 @@ """ - test_formats.py + test_formats_old.py Vladimir Diaz diff --git a/tests/test_indefinite_freeze_attack.py b/tests/test_indefinite_freeze_attack_old.py similarity index 99% rename from tests/test_indefinite_freeze_attack.py rename to tests/test_indefinite_freeze_attack_old.py index b8693dd0..69d063a6 100755 --- a/tests/test_indefinite_freeze_attack.py +++ b/tests/test_indefinite_freeze_attack_old.py @@ -5,7 +5,7 @@ """ - test_indefinite_freeze_attack.py + test_indefinite_freeze_attack_old.py Konstantin Andrianov. @@ -36,7 +36,6 @@ metadata without the client being aware. """ -import datetime import os import time import tempfile diff --git a/tests/test_key_revocation_integration.py b/tests/test_key_revocation_integration_old.py similarity index 99% rename from tests/test_key_revocation_integration.py rename to tests/test_key_revocation_integration_old.py index 4c007134..8cb77f12 100755 --- a/tests/test_key_revocation_integration.py +++ b/tests/test_key_revocation_integration_old.py @@ -5,7 +5,7 @@ """ - test_key_revocation_integration.py + test_key_revocation_integration_old.py Vladimir Diaz. @@ -18,7 +18,7 @@ Integration test that verifies top-level roles are updated after all of their - keys have been revoked. There are unit tests in 'test_repository_tool.py' + keys have been revoked. There are unit tests in 'test_repository_tool_old.py' that verify key and role revocation of specific roles, but these should be expanded to verify key revocations over the span of multiple snapshots of the repository. diff --git a/tests/test_keydb.py b/tests/test_keydb_old.py similarity index 99% rename from tests/test_keydb.py rename to tests/test_keydb_old.py index b075dd4a..b76b5c0f 100755 --- a/tests/test_keydb.py +++ b/tests/test_keydb_old.py @@ -5,7 +5,7 @@ """ - test_keydb.py + test_keydb_old.py Vladimir Diaz diff --git a/tests/test_log.py b/tests/test_log_old.py similarity index 99% rename from tests/test_log.py rename to tests/test_log_old.py index 82637f50..a92661b3 100755 --- a/tests/test_log.py +++ b/tests/test_log_old.py @@ -5,7 +5,7 @@ """ - test_log.py + test_log_old.py Vladimir Diaz diff --git a/tests/test_mirrors.py b/tests/test_mirrors_old.py similarity index 99% rename from tests/test_mirrors.py rename to tests/test_mirrors_old.py index ed87ff18..0d530154 100755 --- a/tests/test_mirrors.py +++ b/tests/test_mirrors_old.py @@ -5,7 +5,7 @@ """ - test_mirrors.py + test_mirrors_old.py Konstantin Andrianov. diff --git a/tests/test_mix_and_match_attack.py b/tests/test_mix_and_match_attack_old.py similarity index 99% rename from tests/test_mix_and_match_attack.py rename to tests/test_mix_and_match_attack_old.py index 2d9d672a..cc033c29 100755 --- a/tests/test_mix_and_match_attack.py +++ b/tests/test_mix_and_match_attack_old.py @@ -5,7 +5,7 @@ """ - test_mix_and_match_attack.py + test_mix_and_match_attack_old.py Konstantin Andrianov. diff --git a/tests/test_multiple_repositories_integration.py b/tests/test_multiple_repositories_integration_old.py similarity index 99% rename from tests/test_multiple_repositories_integration.py rename to tests/test_multiple_repositories_integration_old.py index 0339a0d2..63877648 100755 --- a/tests/test_multiple_repositories_integration.py +++ b/tests/test_multiple_repositories_integration_old.py @@ -5,7 +5,7 @@ """ - test_multiple_repositories_integration.py + test_multiple_repositories_integration_old.py Vladimir Diaz diff --git a/tests/test_replay_attack.py b/tests/test_replay_attack_old.py similarity index 99% rename from tests/test_replay_attack.py rename to tests/test_replay_attack_old.py index 05cf572c..92dc3ba4 100755 --- a/tests/test_replay_attack.py +++ b/tests/test_replay_attack_old.py @@ -5,7 +5,7 @@ """ - test_replay_attack.py + test_replay_attack_old.py Konstantin Andrianov. diff --git a/tests/test_repository_lib.py b/tests/test_repository_lib_old.py similarity index 99% rename from tests/test_repository_lib.py rename to tests/test_repository_lib_old.py index 96dcb0e0..aa784a2e 100755 --- a/tests/test_repository_lib.py +++ b/tests/test_repository_lib_old.py @@ -5,7 +5,7 @@ """ - test_repository_lib.py + test_repository_lib_old.py Vladimir Diaz diff --git a/tests/test_repository_tool.py b/tests/test_repository_tool_old.py similarity index 99% rename from tests/test_repository_tool.py rename to tests/test_repository_tool_old.py index be0333c3..8b04a881 100755 --- a/tests/test_repository_tool.py +++ b/tests/test_repository_tool_old.py @@ -5,7 +5,7 @@ """ - test_repository_tool.py + test_repository_tool_old.py Vladimir Diaz diff --git a/tests/test_roledb.py b/tests/test_roledb_old.py similarity index 99% rename from tests/test_roledb.py rename to tests/test_roledb_old.py index 73405b21..04b76e95 100755 --- a/tests/test_roledb.py +++ b/tests/test_roledb_old.py @@ -5,7 +5,7 @@ """ - test_roledb.py + test_roledb_old.py Vladimir Diaz @@ -776,7 +776,7 @@ def setUpModule(): def tearDownModule(): # tearDownModule() is called after all the tests have run. # Ensure we clean up roledb. Courtesy is contagious, and it begins with - # test_roledb.py. + # test_roledb_old.py. tuf.roledb.clear_roledb() diff --git a/tests/test_root_versioning_integration.py b/tests/test_root_versioning_integration_old.py similarity index 99% rename from tests/test_root_versioning_integration.py rename to tests/test_root_versioning_integration_old.py index 50120298..251bdfe6 100755 --- a/tests/test_root_versioning_integration.py +++ b/tests/test_root_versioning_integration_old.py @@ -5,7 +5,7 @@ """ - test_root_versioning_integration.py + test_root_versioning_integration_old.py Evan Cordell. diff --git a/tests/test_sig.py b/tests/test_sig_old.py similarity index 99% rename from tests/test_sig.py rename to tests/test_sig_old.py index a49c59c2..d93659da 100755 --- a/tests/test_sig.py +++ b/tests/test_sig_old.py @@ -5,7 +5,7 @@ """ - test_sig.py + test_sig_old.py Geremy Condra diff --git a/tests/test_slow_retrieval_attack.py b/tests/test_slow_retrieval_attack_old.py similarity index 99% rename from tests/test_slow_retrieval_attack.py rename to tests/test_slow_retrieval_attack_old.py index 6cf2e1a8..9f22c88f 100755 --- a/tests/test_slow_retrieval_attack.py +++ b/tests/test_slow_retrieval_attack_old.py @@ -5,7 +5,7 @@ """ - test_slow_retrieval_attack.py + test_slow_retrieval_attack_old.py Konstantin Andrianov. @@ -152,7 +152,7 @@ def setUp(self): repository_basepath = self.repository_directory[len(os.getcwd()):] self.server_process_handler = utils.TestServerProcess(log=logger, - server='slow_retrieval_server.py') + server='slow_retrieval_server_old.py') logger.info('Slow Retrieval Server process started.') diff --git a/tests/test_tutorial.py b/tests/test_tutorial_old.py similarity index 99% rename from tests/test_tutorial.py rename to tests/test_tutorial_old.py index 32819b38..ac33dec8 100755 --- a/tests/test_tutorial.py +++ b/tests/test_tutorial_old.py @@ -2,7 +2,7 @@ """ - test_tutorial.py + test_tutorial_old.py See LICENSE-MIT OR LICENSE for licensing information. diff --git a/tests/test_unittest_toolbox.py b/tests/test_unittest_toolbox_old.py similarity index 97% rename from tests/test_unittest_toolbox.py rename to tests/test_unittest_toolbox_old.py index 5bd4169c..d26d0792 100755 --- a/tests/test_unittest_toolbox.py +++ b/tests/test_unittest_toolbox_old.py @@ -5,7 +5,7 @@ """ - test_unittest_toolbox.py + test_unittest_toolbox_old.py Vladimir Diaz diff --git a/tests/test_updater.py b/tests/test_updater_old.py similarity index 99% rename from tests/test_updater.py rename to tests/test_updater_old.py index 9f79fd8b..f2148855 100755 --- a/tests/test_updater.py +++ b/tests/test_updater_old.py @@ -5,7 +5,7 @@ """ - test_updater.py + test_updater_old.py Konstantin Andrianov. @@ -21,7 +21,7 @@ See LICENSE-MIT OR LICENSE for licensing information. - 'test_updater.py' provides a collection of methods that test the public / + 'test_updater.py_old' provides a collection of methods that test the public / non-public methods and functions of 'tuf.client.updater.py'. The 'unittest_toolbox.py' module was created to provide additional testing @@ -89,7 +89,7 @@ def setUpClass(cls): # Launch a SimpleHTTPServer (serves files in the current directory). # Test cases will request metadata and target files that have been # pre-generated in 'tuf/tests/repository_data', which will be served - # by the SimpleHTTPServer launched here. The test cases of 'test_updater.py' + # by the SimpleHTTPServer launched here. The test cases of 'test_updater_old.py' # assume the pre-generated metadata files have a specific structure, such # as a delegated role 'targets/role1', three target files, five key files, # etc. diff --git a/tests/test_updater_root_rotation_integration.py b/tests/test_updater_root_rotation_integration_old.py similarity index 99% rename from tests/test_updater_root_rotation_integration.py rename to tests/test_updater_root_rotation_integration_old.py index 26faebb9..b8f93043 100755 --- a/tests/test_updater_root_rotation_integration.py +++ b/tests/test_updater_root_rotation_integration_old.py @@ -5,7 +5,7 @@ """ - test_updater_root_rotation_integration.py + test_updater_root_rotation_integration_old.py Evan Cordell. @@ -71,8 +71,9 @@ def setUpClass(cls): # Launch a SimpleHTTPServer (serves files in the current directory). Test # cases will request metadata and target files that have been pre-generated # in 'tuf/tests/repository_data', which will be served by the - # SimpleHTTPServer launched here. The test cases of 'test_updater.py' - # assume the pre-generated metadata files have a specific structure, such + # SimpleHTTPServer launched here. The test cases of + # 'test_updater_root_rotation_integration_old.py' assume the + # pre-generated metadata files have a specific structure, such # as a delegated role 'targets/role1', three target files, five key files, # etc. cls.server_process_handler = utils.TestServerProcess(log=logger) diff --git a/tests/test_utils.py b/tests/test_utils.py index 2f1adeac..6ad06a0f 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -63,7 +63,7 @@ def test_simple_https_server_startup(self) -> None: good_cert_path = os.path.join("ssl_certs", "ssl_cert.crt") server_process_handler = utils.TestServerProcess( log=logger, - server="simple_https_server.py", + server="simple_https_server_old.py", extra_cmd_args=[good_cert_path], ) @@ -73,7 +73,7 @@ def test_simple_https_server_startup(self) -> None: # Test when no cert file is provided server_process_handler = utils.TestServerProcess( - log=logger, server="simple_https_server.py" + log=logger, server="simple_https_server_old.py" ) # Make sure we can connect to the server @@ -84,7 +84,7 @@ def test_simple_https_server_startup(self) -> None: non_existing_cert_path = os.path.join("ssl_certs", "non_existing.crt") server_process_handler = utils.TestServerProcess( log=logger, - server="simple_https_server.py", + server="simple_https_server_old.py", extra_cmd_args=[non_existing_cert_path], ) @@ -95,7 +95,7 @@ def test_simple_https_server_startup(self) -> None: def test_slow_retrieval_server_startup(self) -> None: # Test normal case server_process_handler = utils.TestServerProcess( - log=logger, server="slow_retrieval_server.py" + log=logger, server="slow_retrieval_server_old.py" ) # Make sure we can connect to the server diff --git a/tuf/ATTACKS.md b/tuf/ATTACKS.md index 56042516..f76cf0b4 100644 --- a/tuf/ATTACKS.md +++ b/tuf/ATTACKS.md @@ -289,14 +289,14 @@ exception or error when it detects that a malicious server is serving it data at a slow enough rate. We first spawn the server that slowly streams data to the client. The -'slow_retrieval_server.py' module (can be found in the tests/ directory of the +'slow_retrieval_server_old.py' module (can be found in the tests/ directory of the source code) should be copied over to the server's 'repository/' directory from which to launch it. ```Bash -# Before launching the slow retrieval server, copy 'slow_retrieval_server.py' +# Before launching the slow retrieval server, copy 'slow_retrieval_server_old.py' # to the 'repository/' directory and run it from that directory as follows: -$ python3 slow_retrieval_server.py 8002 mode_2 +$ python3 slow_retrieval_server_old.py 8002 mode_2 ``` The client may now make a request to the slow retrieval server on port 8002.