Migrated remaining os.system to sp.check_call

This commit is contained in:
Kkevsterrr 2020-03-13 08:42:03 -04:00
parent 1c5f8bd8a5
commit d7c5ed50c2
1 changed files with 12 additions and 5 deletions

View File

@ -8,6 +8,7 @@ sys.path.append(BASEPATH)
import engine
def test_engine():
"""
Basic engine test
@ -35,7 +36,7 @@ def test_engine_sleep():
# Create the engine in debug mode
with engine.Engine(port, strategy, log_level="info") as eng:
os.system("curl -s http://example.com")
sp.check_call("curl -s http://example.com", shell=True)
# Strategy to use in opposite direction
strategy = "\/ [TCP:flags:SA]-sleep{1}-|"
@ -45,7 +46,6 @@ def test_engine_sleep():
sp.check_call("curl -s http://example.com", shell=True)
def test_engine_trace():
"""
Basic engine test with trace
@ -57,7 +57,11 @@ def test_engine_trace():
# Create the engine in debug mode
with engine.Engine(port, strategy, log_level="debug") as eng:
os.system("curl -m 5 http://example.com?q=ultrasurf")
try:
sp.check_call("curl -m 5 http://example.com", shell=True)
except sp.CalledProcessError as exc:
print("Expecting timeout exception")
print(exc)
def test_engine_drop():
@ -71,5 +75,8 @@ def test_engine_drop():
# Create the engine in debug mode
with engine.Engine(port, strategy, log_level="debug") as eng:
os.system("curl -m 3 http://example.com?q=ultrasurf")
try:
sp.check_call("curl -m 3 http://example.com")
except sp.CalledProcessError as exc:
print("Expecting timeout exception")
print(exc)