From 917d51bd22ea75408bcf461b09b6cf78c44e1162 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Fri, 15 Jul 2016 15:01:35 +1200 Subject: Fix HAR extractor Thanks to @mhils --- test/mitmproxy/test_examples.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'test') 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 -- cgit v1.2.3