aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-07-15 15:01:35 +1200
committerAldo Cortesi <aldo@nullcube.com>2016-07-15 15:01:35 +1200
commit917d51bd22ea75408bcf461b09b6cf78c44e1162 (patch)
tree05f6ed396c29f103aa4da3e731f8f3d366797d97 /test
parent92a5076bd01b71e8ed709901d63de9ee37385c3b (diff)
downloadmitmproxy-917d51bd22ea75408bcf461b09b6cf78c44e1162.tar.gz
mitmproxy-917d51bd22ea75408bcf461b09b6cf78c44e1162.tar.bz2
mitmproxy-917d51bd22ea75408bcf461b09b6cf78c44e1162.zip
Fix HAR extractor
Thanks to @mhils
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_examples.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/mitmproxy/test_examples.py b/test/mitmproxy/test_examples.py
index ef97219c..f8646336 100644
--- a/test/mitmproxy/test_examples.py
+++ b/test/mitmproxy/test_examples.py
@@ -1,5 +1,6 @@
import json
+import six
import sys
import os.path
from mitmproxy.flow import master
@@ -112,7 +113,7 @@ class TestScripts(mastertest.MasterTest):
)
path = os.path.join(tdir, "file")
- m, sc = tscript("har_extractor.py", path)
+ m, sc = tscript("har_extractor.py", six.moves.shlex_quote(path))
f = tutils.tflow(
req=netutils.treq(**times),
resp=netutils.tresp(**times)
@@ -120,6 +121,6 @@ class TestScripts(mastertest.MasterTest):
self.invoke(m, "response", f)
m.addons.remove(sc)
- fp = open(path, "rb")
- test_data = json.load(fp)
+ with open(path, "rb") as f:
+ test_data = json.load(f)
assert len(test_data["log"]["pages"]) == 1