else: import unittest2 as unittest import tuf.formats import tuf.util import tuf.log import tuf.client.updater as updater import tuf.repository_tool as repo_tool import tuf.unittest_toolbox as unittest_toolbox import six # The repository tool is imported and logs console messages by default. Disable # console log messages generated by this unit test. repo_tool.disable_console_log_messages() logger = logging.getLogger('tuf.test_replay_attack') class TestReplayAttack(unittest_toolbox.Modified_TestCase): @classmethod def setUpClass(cls): # setUpClass() is called before any of the test cases are executed. # Create a temporary directory to store the repository, metadata, and target # files. 'temporary_directory' must be deleted in TearDownModule() so that # temporary files are always removed, even when exceptions occur. cls.temporary_directory = tempfile.mkdtemp(dir=os.getcwd())
from securesystemslib import interface as sslib_interface from securesystemslib import keys as sslib_keys from securesystemslib import settings as sslib_settings from securesystemslib import util as sslib_util from tuf import exceptions from tuf import formats from tuf import keydb from tuf import log from tuf import repository_tool as repo_tool from tuf import roledb # See 'log.py' to learn how logging is handled in TUF. logger = logging.getLogger(__name__) repo_tool.disable_console_log_messages() PROG_NAME = 'repo.py' REPO_DIR = 'tufrepo' CLIENT_DIR = 'tufclient' KEYSTORE_DIR = 'tufkeystore' ROOT_KEY_NAME = 'root_key' TARGETS_KEY_NAME = 'targets_key' SNAPSHOT_KEY_NAME = 'snapshot_key' TIMESTAMP_KEY_NAME = 'timestamp_key' STAGED_METADATA_DIR = 'metadata.staged' METADATA_DIR = 'metadata'