aboutsummaryrefslogtreecommitdiffstats
path: root/test/pathod
diff options
context:
space:
mode:
Diffstat (limited to 'test/pathod')
-rw-r--r--test/pathod/test_pathoc.py4
-rw-r--r--test/pathod/test_pathoc_cmdline.py6
-rw-r--r--test/pathod/test_pathod.py7
-rw-r--r--test/pathod/test_pathod_cmdline.py8
-rw-r--r--test/pathod/tservers.py7
5 files changed, 17 insertions, 15 deletions
diff --git a/test/pathod/test_pathoc.py b/test/pathod/test_pathoc.py
index 297b54d4..85c46fff 100644
--- a/test/pathod/test_pathoc.py
+++ b/test/pathod/test_pathoc.py
@@ -61,10 +61,10 @@ class TestDaemonSSL(PathocTestDaemon):
def test_showssl(self):
assert "certificate chain" in self.tval(["get:/p/200"], showssl=True)
- def test_clientcert(self):
+ def test_clientcert(self, tdata):
self.tval(
["get:/p/200"],
- clientcert=tutils.test_data.path("pathod/data/clientcert/client.pem"),
+ clientcert=tdata.path("pathod/data/clientcert/client.pem"),
)
log = self.d.log()
assert log[0]["request"]["clientcert"]["keyinfo"]
diff --git a/test/pathod/test_pathoc_cmdline.py b/test/pathod/test_pathoc_cmdline.py
index 7bc76ace..fecebe3d 100644
--- a/test/pathod/test_pathoc_cmdline.py
+++ b/test/pathod/test_pathoc_cmdline.py
@@ -4,11 +4,9 @@ from unittest import mock
from pathod import pathoc_cmdline as cmdline
-from mitmproxy.test import tutils
-
@mock.patch("argparse.ArgumentParser.error")
-def test_pathoc(perror):
+def test_pathoc(perror, tdata):
assert cmdline.args_pathoc(["pathoc", "foo.com", "get:/"])
s = io.StringIO()
with pytest.raises(SystemExit):
@@ -53,7 +51,7 @@ def test_pathoc(perror):
[
"pathoc",
"foo.com:8888",
- tutils.test_data.path("pathod/data/request")
+ tdata.path("pathod/data/request")
]
)
assert len(list(a.requests)) == 1
diff --git a/test/pathod/test_pathod.py b/test/pathod/test_pathod.py
index d6522cb6..246bff3b 100644
--- a/test/pathod/test_pathod.py
+++ b/test/pathod/test_pathod.py
@@ -5,11 +5,14 @@ import pytest
from pathod import pathod
from mitmproxy.net import tcp
from mitmproxy import exceptions
-from mitmproxy.test import tutils
+from mitmproxy.utils import data
from . import tservers
+cdata = data.Data(__name__)
+
+
class TestPathod:
def test_logging(self):
@@ -57,7 +60,7 @@ class TestNotAfterConnect(tservers.DaemonTests):
class TestCustomCert(tservers.DaemonTests):
ssl = True
ssloptions = dict(
- certs=[("*", tutils.test_data.path("pathod/data/testkey.pem"))],
+ certs=[("*", cdata.path("data/testkey.pem"))],
)
def test_connect(self):
diff --git a/test/pathod/test_pathod_cmdline.py b/test/pathod/test_pathod_cmdline.py
index 34baf491..37427179 100644
--- a/test/pathod/test_pathod_cmdline.py
+++ b/test/pathod/test_pathod_cmdline.py
@@ -2,8 +2,6 @@ from unittest import mock
from pathod import pathod_cmdline as cmdline
-from mitmproxy.test import tutils
-
def test_parse_anchor_spec():
assert cmdline.parse_anchor_spec("foo=200") == ("foo", "200")
@@ -11,14 +9,14 @@ def test_parse_anchor_spec():
@mock.patch("argparse.ArgumentParser.error")
-def test_pathod(perror):
+def test_pathod(perror, tdata):
assert cmdline.args_pathod(["pathod"])
a = cmdline.args_pathod(
[
"pathod",
"--cert",
- tutils.test_data.path("pathod/data/testkey.pem")
+ tdata.path("pathod/data/testkey.pem")
]
)
assert a.ssl_certs
@@ -46,7 +44,7 @@ def test_pathod(perror):
[
"pathod",
"-a",
- "foo=" + tutils.test_data.path("pathod/data/response")
+ "foo=" + tdata.path("pathod/data/response")
]
)
assert a.anchors
diff --git a/test/pathod/tservers.py b/test/pathod/tservers.py
index a7c92964..8fad133a 100644
--- a/test/pathod/tservers.py
+++ b/test/pathod/tservers.py
@@ -8,7 +8,7 @@ import urllib
from mitmproxy.net import tcp
-from mitmproxy.test import tutils
+from mitmproxy.utils import data
from pathod import language
from pathod import pathoc
@@ -17,6 +17,9 @@ from pathod import test
from pathod.pathod import CA_CERT_NAME
+cdata = data.Data(__name__)
+
+
def treader(bytes):
"""
Construct a tcp.Read object from bytes.
@@ -41,7 +44,7 @@ class DaemonTests:
opts["confdir"] = cls.confdir
so = pathod.SSLOptions(**opts)
cls.d = test.Daemon(
- staticdir=tutils.test_data.path("pathod/data"),
+ staticdir=cdata.path("data"),
anchors=[
(re.compile("/anchor/.*"), "202:da")
],