diff options
author | Aldo Cortesi <aldo@corte.si> | 2018-04-26 11:47:07 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-26 11:47:07 +1200 |
commit | b18e0fa2bcac8b55b1d8325f4a2b1f916e3c0d9b (patch) | |
tree | 332a42ef3dfd28ec0f4496b1f8ae79464f069069 /test/examples/test_har_dump.py | |
parent | 5546f0a05ec21db986f0639cee9e89452ba68642 (diff) | |
parent | 95e690ba31db9cb35eaa7e22ecebbe06ea8e2044 (diff) | |
download | mitmproxy-b18e0fa2bcac8b55b1d8325f4a2b1f916e3c0d9b.tar.gz mitmproxy-b18e0fa2bcac8b55b1d8325f4a2b1f916e3c0d9b.tar.bz2 mitmproxy-b18e0fa2bcac8b55b1d8325f4a2b1f916e3c0d9b.zip |
Merge pull request #3071 from cortesi/tickless
asyncio: shift script reloading out of the tick event
Diffstat (limited to 'test/examples/test_har_dump.py')
-rw-r--r-- | test/examples/test_har_dump.py | 18 |
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) |