mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
2ed03ee751
10 changed files with 14 additions and 60 deletions
|
|
@ -24,11 +24,9 @@
|
|||
import random
|
||||
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
||||
|
||||
|
||||
DELAY = 1
|
||||
|
||||
|
||||
|
||||
# HTTP request handler.
|
||||
class Handler(BaseHTTPRequestHandler):
|
||||
|
||||
|
|
@ -76,4 +74,4 @@ def run(port):
|
|||
else:
|
||||
port = get_random_port()
|
||||
|
||||
run(port)
|
||||
run(port)
|
||||
|
|
|
|||
|
|
@ -40,11 +40,6 @@
|
|||
|
||||
|
||||
|
||||
# Disable logging.
|
||||
util_test_tools.disable_logging()
|
||||
|
||||
|
||||
|
||||
class ArbitraryPackageAlert(Exception):
|
||||
pass
|
||||
|
||||
|
|
@ -149,4 +144,4 @@ def test_arbitrary_package_attack(TUF=False):
|
|||
test_arbitrary_package_attack(TUF=True)
|
||||
|
||||
except ArbitraryPackageAlert, error:
|
||||
print error
|
||||
print error
|
||||
|
|
|
|||
|
|
@ -43,12 +43,6 @@
|
|||
from tuf.interposition import urllib_tuf
|
||||
|
||||
|
||||
|
||||
# Disable logging.
|
||||
util_test_tools.disable_logging()
|
||||
|
||||
|
||||
|
||||
class EndlessDataAttack(Exception):
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -27,18 +27,17 @@
|
|||
import tempfile
|
||||
import time
|
||||
|
||||
import util_test_tools
|
||||
import tuf
|
||||
import tuf.formats
|
||||
import tuf.tests.system_tests.util_test_tools
|
||||
import tuf.repo.keystore
|
||||
import tuf.repo.signerlib as signerlib
|
||||
import tuf.repo.signercli as signercli
|
||||
from tuf.interposition import urllib_tuf
|
||||
|
||||
|
||||
# Disable logging.
|
||||
util_test_tools.disable_logging()
|
||||
|
||||
version = 1
|
||||
|
||||
|
||||
class ExtraneousDependenciesAttackAlert(Exception):
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -27,21 +27,16 @@
|
|||
import tempfile
|
||||
import util_test_tools
|
||||
|
||||
import tuf
|
||||
import tuf.formats
|
||||
import tuf.repo.signerlib as signerlib
|
||||
from tuf.interposition import urllib_tuf
|
||||
|
||||
|
||||
# Disable logging.
|
||||
util_test_tools.disable_logging()
|
||||
|
||||
|
||||
|
||||
class IndefiniteFreezeAttackAlert(Exception):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
EXPIRATION = 1 # second(s)
|
||||
version = 1
|
||||
|
||||
|
|
|
|||
|
|
@ -44,11 +44,6 @@
|
|||
from tuf.interposition import urllib_tuf
|
||||
|
||||
|
||||
# Disable logging.
|
||||
util_test_tools.disable_logging()
|
||||
|
||||
|
||||
|
||||
class MixAndMatchAttackAlert(Exception):
|
||||
pass
|
||||
|
||||
|
|
@ -195,4 +190,4 @@ def test_mix_and_match_attack(TUF=False):
|
|||
try:
|
||||
test_mix_and_match_attack(TUF=True)
|
||||
except MixAndMatchAttackAlert, error:
|
||||
print error
|
||||
print error
|
||||
|
|
|
|||
|
|
@ -38,16 +38,10 @@
|
|||
import urllib
|
||||
import tempfile
|
||||
|
||||
import util_test_tools
|
||||
import tuf.tests.system_tests.util_test_tools as util_test_tools
|
||||
from tuf.interposition import urllib_tuf
|
||||
|
||||
|
||||
|
||||
# Disable logging.
|
||||
util_test_tools.disable_logging()
|
||||
|
||||
|
||||
|
||||
class TestSetupError(Exception):
|
||||
pass
|
||||
|
||||
|
|
@ -189,4 +183,4 @@ def test_replay_attack(TUF=False):
|
|||
try:
|
||||
test_replay_attack(TUF=True)
|
||||
except ReplayAttackAlert, error:
|
||||
print error
|
||||
print error
|
||||
|
|
|
|||
|
|
@ -42,15 +42,10 @@
|
|||
import subprocess
|
||||
from multiprocessing import Process
|
||||
|
||||
import util_test_tools
|
||||
import tuf.tests.system_tests.util_test_tools as util_test_tools
|
||||
from tuf.interposition import urllib_tuf
|
||||
|
||||
|
||||
# Disable logging.
|
||||
util_test_tools.disable_logging()
|
||||
|
||||
|
||||
|
||||
class SlowRetrievalAttackAlert(Exception):
|
||||
pass
|
||||
|
||||
|
|
@ -72,7 +67,8 @@ def test_slow_retrieval_attack(TUF=False):
|
|||
# Launch the server.
|
||||
port = random.randint(30000, 45000)
|
||||
command = ['python', 'slow_retrieval_server.py', str(port)]
|
||||
server_process = subprocess.Popen(command, stderr=subprocess.PIPE)
|
||||
server_process = subprocess.Popen(command, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
time.sleep(.1)
|
||||
|
||||
try:
|
||||
|
|
@ -134,4 +130,4 @@ def test_slow_retrieval_attack(TUF=False):
|
|||
try:
|
||||
test_slow_retrieval_attack(TUF=True)
|
||||
except SlowRetrievalAttackAlert, error:
|
||||
print error
|
||||
print error
|
||||
|
|
|
|||
|
|
@ -147,12 +147,6 @@
|
|||
|
||||
logger = logging.getLogger('tuf.tests.system_tests.util_test_tools')
|
||||
|
||||
# Disable logging for cleaner output.
|
||||
def disable_logging():
|
||||
logging.getLogger('tuf')
|
||||
logging.disable(logging.CRITICAL)
|
||||
|
||||
|
||||
PASSWD = 'test'
|
||||
version = 1
|
||||
|
||||
|
|
|
|||
|
|
@ -158,12 +158,6 @@ def setUp(self):
|
|||
|
||||
|
||||
def tearDown(self):
|
||||
# Removing 'tuf.log' file from current working directory.
|
||||
"""
|
||||
tuf_log_path = os.path.join(os.getcwd(), 'tuf.log')
|
||||
if os.path.exists(tuf_log_path):
|
||||
os.unlink(tuf_log_path)
|
||||
"""
|
||||
for cleanup_function in self._cleanup:
|
||||
# Perform clean up by executing clean-up functions.
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue