aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2011-03-12 15:08:06 +1300
committerAldo Cortesi <aldo@nullcube.com>2011-03-12 15:08:06 +1300
commit96b10ca486c88e6918aabdf8d90cde3a91cf8e1a (patch)
treeb8d661f5392d2669649cc110dab05f5acb02a515
parentfbbc43a5b24f24657bb7a9d6eff50b3db77e5e7f (diff)
downloadmitmproxy-96b10ca486c88e6918aabdf8d90cde3a91cf8e1a.tar.gz
mitmproxy-96b10ca486c88e6918aabdf8d90cde3a91cf8e1a.tar.bz2
mitmproxy-96b10ca486c88e6918aabdf8d90cde3a91cf8e1a.zip
console.py 100% test coverage
-rw-r--r--libmproxy/console.py3
-rw-r--r--test/test_console.py17
2 files changed, 16 insertions, 4 deletions
diff --git a/libmproxy/console.py b/libmproxy/console.py
index f95d028e..13c31435 100644
--- a/libmproxy/console.py
+++ b/libmproxy/console.py
@@ -699,7 +699,6 @@ class ConsoleState(flow.State):
flow.State.__init__(self)
self.focus = None
self.beep = None
- self.store = None
self.view_body_mode = VIEW_BODY_RAW
self.view_flow_mode = VIEW_FLOW_REQUEST
@@ -716,8 +715,6 @@ class ConsoleState(flow.State):
return f
def add_response(self, resp):
- if self.store is not None:
- self.store.save_response(resp)
f = flow.State.add_response(self, resp)
if self.focus is None:
self.set_focus(0)
diff --git a/test/test_console.py b/test/test_console.py
index 90ebdc55..034f8ea1 100644
--- a/test/test_console.py
+++ b/test/test_console.py
@@ -105,6 +105,15 @@ class uformat_flow(libpry.AutoTree):
assert ('method', '[replay] ') in console.format_flow(f, True)
assert ('method', '[replay] ') in console.format_flow(f, True, True)
+ f.response.code = 404
+ assert ('error', '404') in console.format_flow(f, True, True)
+ f.response.headers["content-type"] = ["text/html"]
+ assert ('text', ' text/html') in console.format_flow(f, True, True)
+
+ f.response =None
+ f.error = proxy.Error(f.request, "error")
+ assert ('error', 'error') in console.format_flow(f, True, True)
+
class uPathCompleter(libpry.AutoTree):
@@ -147,11 +156,17 @@ class uPathCompleter(libpry.AutoTree):
assert c.final == s
+class uOptions(libpry.AutoTree):
+ def test_all(self):
+ assert console.Options(beep=True)
+
+
tests = [
uformat_keyvals(),
uformat_flow(),
uState(),
- uPathCompleter()
+ uPathCompleter(),
+ uOptions()
]