mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Rename old test files by adding old suffix
Rename test files testing the old code by adding an "old" suffix. This is done, so we can easily exclude them from linting. Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
This commit is contained in:
parent
5aa547d6b6
commit
22fe1e69e4
33 changed files with 53 additions and 53 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
See LICENSE-MIT.txt OR LICENSE-APACHE.txt for licensing information.
|
||||
|
||||
<Purpose>
|
||||
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
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program>
|
||||
simple_https_server.py
|
||||
simple_https_server_old.py
|
||||
|
||||
<Author>
|
||||
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()
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
slow_retrieval_server.py
|
||||
slow_retrieval_server_old.py
|
||||
|
||||
<Author>
|
||||
Konstantin Andrianov.
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<Purpose>
|
||||
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
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_arbitrary_package_attack.py
|
||||
test_arbitrary_package_attack_old.py
|
||||
|
||||
<Author>
|
||||
Konstantin Andrianov.
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_developer_tool.py.
|
||||
test_developer_tool_old.py.
|
||||
|
||||
<Authors>
|
||||
Santiago Torres Arias <torresariass@gmail.com>
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program>
|
||||
test_download.py
|
||||
test_download_old.py
|
||||
|
||||
<Author>
|
||||
Konstantin Andrianov.
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
<Purpose>
|
||||
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)
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_endless_data_attack.py
|
||||
test_endless_data_attack_old.py
|
||||
|
||||
<Author>
|
||||
Konstantin Andrianov.
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_extraneous_dependencies_attack.py
|
||||
test_extraneous_dependencies_attack_old.py
|
||||
|
||||
<Author>
|
||||
Zane Fisher.
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_formats.py
|
||||
test_formats_old.py
|
||||
|
||||
<Author>
|
||||
Vladimir Diaz <vladimir.v.diaz@gmail.com>
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_indefinite_freeze_attack.py
|
||||
test_indefinite_freeze_attack_old.py
|
||||
|
||||
<Author>
|
||||
Konstantin Andrianov.
|
||||
|
|
@ -36,7 +36,6 @@
|
|||
metadata without the client being aware.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
import os
|
||||
import time
|
||||
import tempfile
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_key_revocation_integration.py
|
||||
test_key_revocation_integration_old.py
|
||||
|
||||
<Author>
|
||||
Vladimir Diaz.
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<Purpose>
|
||||
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.
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_keydb.py
|
||||
test_keydb_old.py
|
||||
|
||||
<Author>
|
||||
Vladimir Diaz <vladimir.v.diaz@gmail.com>
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_log.py
|
||||
test_log_old.py
|
||||
|
||||
<Authors>
|
||||
Vladimir Diaz <vladimir.v.diaz@gmail.com>
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program>
|
||||
test_mirrors.py
|
||||
test_mirrors_old.py
|
||||
|
||||
<Author>
|
||||
Konstantin Andrianov.
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_mix_and_match_attack.py
|
||||
test_mix_and_match_attack_old.py
|
||||
|
||||
<Author>
|
||||
Konstantin Andrianov.
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_multiple_repositories_integration.py
|
||||
test_multiple_repositories_integration_old.py
|
||||
|
||||
<Author>
|
||||
Vladimir Diaz <vladimir.v.diaz@gmail.com>
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_replay_attack.py
|
||||
test_replay_attack_old.py
|
||||
|
||||
<Author>
|
||||
Konstantin Andrianov.
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_repository_lib.py
|
||||
test_repository_lib_old.py
|
||||
|
||||
<Author>
|
||||
Vladimir Diaz <vladimir.v.diaz@gmail.com>
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_repository_tool.py
|
||||
test_repository_tool_old.py
|
||||
|
||||
<Author>
|
||||
Vladimir Diaz <vladimir.v.diaz@gmail.com>
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_roledb.py
|
||||
test_roledb_old.py
|
||||
|
||||
<Author>
|
||||
Vladimir Diaz <vladimir.v.diaz@gmail.com>
|
||||
|
|
@ -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()
|
||||
|
||||
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_root_versioning_integration.py
|
||||
test_root_versioning_integration_old.py
|
||||
|
||||
<Author>
|
||||
Evan Cordell.
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_sig.py
|
||||
test_sig_old.py
|
||||
|
||||
<Author>
|
||||
Geremy Condra
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_slow_retrieval_attack.py
|
||||
test_slow_retrieval_attack_old.py
|
||||
|
||||
<Author>
|
||||
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.')
|
||||
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_tutorial.py
|
||||
test_tutorial_old.py
|
||||
|
||||
<Copyright>
|
||||
See LICENSE-MIT OR LICENSE for licensing information.
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_unittest_toolbox.py
|
||||
test_unittest_toolbox_old.py
|
||||
|
||||
<Author>
|
||||
Vladimir Diaz
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_updater.py
|
||||
test_updater_old.py
|
||||
|
||||
<Author>
|
||||
Konstantin Andrianov.
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
See LICENSE-MIT OR LICENSE for licensing information.
|
||||
|
||||
<Purpose>
|
||||
'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.
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""
|
||||
<Program Name>
|
||||
test_updater_root_rotation_integration.py
|
||||
test_updater_root_rotation_integration_old.py
|
||||
|
||||
<Author>
|
||||
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)
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue