aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-10-20 09:35:55 +1300
committerAldo Cortesi <aldo@nullcube.com>2016-10-20 09:35:55 +1300
commit069119364d6490e52ba26f2d8001c6b2bf50ab7b (patch)
treea6308ebd4d1337db08784295eba328a8e8f05514 /test
parent7440232f6036bb29d1c142cd32a9bb27458b30d1 (diff)
downloadmitmproxy-069119364d6490e52ba26f2d8001c6b2bf50ab7b.tar.gz
mitmproxy-069119364d6490e52ba26f2d8001c6b2bf50ab7b.tar.bz2
mitmproxy-069119364d6490e52ba26f2d8001c6b2bf50ab7b.zip
Create mitmproxy.utils hierarchy
- Add mitproxy.utils.lrucache, mitproxy.utils.data
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_examples.py5
-rw-r--r--test/mitmproxy/test_utils_data.py7
-rw-r--r--test/mitmproxy/test_utils_lrucache.py (renamed from test/mitmproxy/test_utils.py)8
-rw-r--r--test/mitmproxy/tutils.py3
-rw-r--r--test/pathod/tutils.py5
5 files changed, 14 insertions, 14 deletions
diff --git a/test/mitmproxy/test_examples.py b/test/mitmproxy/test_examples.py
index 7551c1c8..60d4a1a5 100644
--- a/test/mitmproxy/test_examples.py
+++ b/test/mitmproxy/test_examples.py
@@ -6,17 +6,16 @@ from mitmproxy import options
from mitmproxy import contentviews
from mitmproxy import proxy
from mitmproxy.addons import script
+from mitmproxy.utils import data
from mitmproxy import master
-import netlib.utils
-
from netlib import tutils as netutils
from netlib.http import Headers
from netlib.http import cookies
from . import tutils, mastertest
-example_dir = netlib.utils.Data(__name__).push("../../examples")
+example_dir = data.Data(__name__).push("../../examples")
class ScriptError(Exception):
diff --git a/test/mitmproxy/test_utils_data.py b/test/mitmproxy/test_utils_data.py
new file mode 100644
index 00000000..c6e4420e
--- /dev/null
+++ b/test/mitmproxy/test_utils_data.py
@@ -0,0 +1,7 @@
+from mitmproxy.utils import data
+from . import tutils
+
+
+def test_pkg_data():
+ assert data.pkg_data.path("tools/console")
+ tutils.raises("does not exist", data.pkg_data.path, "nonexistent")
diff --git a/test/mitmproxy/test_utils.py b/test/mitmproxy/test_utils_lrucache.py
index ed59f484..f75fb5e8 100644
--- a/test/mitmproxy/test_utils.py
+++ b/test/mitmproxy/test_utils_lrucache.py
@@ -1,12 +1,4 @@
from mitmproxy import utils
-from . import tutils
-
-utils.CERT_SLEEP_TIME = 0
-
-
-def test_pkg_data():
- assert utils.pkg_data.path("tools/console")
- tutils.raises("does not exist", utils.pkg_data.path, "nonexistent")
def test_LRUCache():
diff --git a/test/mitmproxy/tutils.py b/test/mitmproxy/tutils.py
index eb0c90e9..71dd20a4 100644
--- a/test/mitmproxy/tutils.py
+++ b/test/mitmproxy/tutils.py
@@ -16,6 +16,7 @@ from mitmproxy import connections
from mitmproxy import flow
from mitmproxy import http
from mitmproxy import tcp
+from mitmproxy.utils import data
def _skip_windows(*args):
@@ -208,4 +209,4 @@ def capture_stderr(command, *args, **kwargs):
sys.stderr = out
-test_data = netlib.utils.Data(__name__)
+test_data = data.Data(__name__)
diff --git a/test/pathod/tutils.py b/test/pathod/tutils.py
index c2243578..171d97a4 100644
--- a/test/pathod/tutils.py
+++ b/test/pathod/tutils.py
@@ -5,8 +5,9 @@ import requests
import io
import urllib
+from mitmproxy.utils import data
+
from netlib import tcp
-from netlib import utils
from netlib import tutils
from pathod import language
@@ -142,7 +143,7 @@ tmpdir = tutils.tmpdir
raises = tutils.raises
-test_data = utils.Data(__name__)
+test_data = data.Data(__name__)
def render(r, settings=language.Settings()):