aboutsummaryrefslogtreecommitdiffstats
path: root/test/examples/test_har_dump.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2018-04-23 11:05:58 +1200
committerAldo Cortesi <aldo@nullcube.com>2018-04-23 19:16:33 +1200
commit95e690ba31db9cb35eaa7e22ecebbe06ea8e2044 (patch)
tree62f5a3ea58ef5a2b2f39b092df97fcd5b6d9f16d /test/examples/test_har_dump.py
parent0ba10b61090274a1f2ca70a8fb1d68830cb44607 (diff)
downloadmitmproxy-95e690ba31db9cb35eaa7e22ecebbe06ea8e2044.tar.gz
mitmproxy-95e690ba31db9cb35eaa7e22ecebbe06ea8e2044.tar.bz2
mitmproxy-95e690ba31db9cb35eaa7e22ecebbe06ea8e2044.zip
test: shift test_data out of our public API
Diffstat (limited to 'test/examples/test_har_dump.py')
-rw-r--r--test/examples/test_har_dump.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/test/examples/test_har_dump.py b/test/examples/test_har_dump.py
index 11cd5c29..7eb4f5f9 100644
--- a/test/examples/test_har_dump.py
+++ b/test/examples/test_har_dump.py
@@ -5,8 +5,6 @@ from mitmproxy.test import tutils
from mitmproxy.test import taddons
from mitmproxy.net.http import cookies
-example_dir = tutils.test_data.push("../examples")
-
class TestHARDump:
def flow(self, resp_content=b'message'):
@@ -21,9 +19,9 @@ class TestHARDump:
resp=tutils.tresp(content=resp_content, **times)
)
- def test_simple(self, tmpdir):
+ def test_simple(self, tmpdir, tdata):
with taddons.context() as tctx:
- a = tctx.script(example_dir.path("complex/har_dump.py"))
+ a = tctx.script(tdata.path("../examples/complex/har_dump.py"))
path = str(tmpdir.join("somefile"))
tctx.configure(a, hardump=path)
tctx.invoke(a, "response", self.flow())
@@ -32,9 +30,9 @@ class TestHARDump:
har = json.load(inp)
assert len(har["log"]["entries"]) == 1
- def test_base64(self, tmpdir):
+ def test_base64(self, tmpdir, tdata):
with taddons.context() as tctx:
- a = tctx.script(example_dir.path("complex/har_dump.py"))
+ a = tctx.script(tdata.path("../examples/complex/har_dump.py"))
path = str(tmpdir.join("somefile"))
tctx.configure(a, hardump=path)
@@ -46,9 +44,9 @@ class TestHARDump:
har = json.load(inp)
assert har["log"]["entries"][0]["response"]["content"]["encoding"] == "base64"
- def test_format_cookies(self):
+ def test_format_cookies(self, tdata):
with taddons.context() as tctx:
- a = tctx.script(example_dir.path("complex/har_dump.py"))
+ a = tctx.script(tdata.path("../examples/complex/har_dump.py"))
CA = cookies.CookieAttrs
@@ -65,9 +63,9 @@ class TestHARDump:
f = a.format_cookies([("n", "v", CA([("expires", "Mon, 24-Aug-2037 00:00:00 GMT")]))])[0]
assert f['expires']
- def test_binary(self, tmpdir):
+ def test_binary(self, tmpdir, tdata):
with taddons.context() as tctx:
- a = tctx.script(example_dir.path("complex/har_dump.py"))
+ a = tctx.script(tdata.path("../examples/complex/har_dump.py"))
path = str(tmpdir.join("somefile"))
tctx.configure(a, hardump=path)