From cdd5a53767e51a6d992bf8d08df2733e7af916b8 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Tue, 7 Feb 2012 16:39:37 +1300 Subject: Refactor console. Split the console implementation out into logical components. --- test/test_console.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/test_console.py b/test/test_console.py index a935c146..3de9cca4 100644 --- a/test/test_console.py +++ b/test/test_console.py @@ -1,4 +1,5 @@ from libmproxy import console, filt, flow +from libmproxy.console import common import tutils import libpry @@ -78,7 +79,7 @@ class uState(libpry.AutoTree): class uformat_keyvals(libpry.AutoTree): def test_simple(self): - assert console.format_keyvals( + assert common.format_keyvals( [ ("aa", "bb"), None, @@ -93,11 +94,11 @@ class uformat_flow(libpry.AutoTree): def test_simple(self): f = tutils.tflow() foc = ('focus', '>>') - assert foc not in console.format_flow(f, False) - assert foc in console.format_flow(f, True) + assert foc not in common.format_flow(f, False) + assert foc in common.format_flow(f, True) - assert foc not in console.format_flow(f, False, True) - assert foc in console.format_flow(f, True, True) + assert foc not in common.format_flow(f, False, True) + assert foc in common.format_flow(f, True, True) f.response = tutils.tresp() f.request = f.response.request @@ -105,17 +106,17 @@ class uformat_flow(libpry.AutoTree): f.request._set_replay() f.response._set_replay() - assert ('method', '[replay]') in console.format_flow(f, True) - assert ('method', '[replay]') in console.format_flow(f, True, True) + assert ('method', '[replay]') in common.format_flow(f, True) + assert ('method', '[replay]') in common.format_flow(f, True, True) f.response.code = 404 - assert ('error', '404') in console.format_flow(f, True, True) + assert ('error', '404') in common.format_flow(f, True, True) f.response.headers["content-type"] = ["text/html"] - assert ('text', ' text/html') in console.format_flow(f, True, True) + assert ('text', ' text/html') in common.format_flow(f, True, True) f.response =None f.error = flow.Error(f.request, "error") - assert ('error', 'error') in console.format_flow(f, True, True) + assert ('error', 'error') in common.format_flow(f, True, True) @@ -169,7 +170,7 @@ class uOptions(libpry.AutoTree): tests = [ uformat_keyvals(), uformat_flow(), - uState(), + uState(), uPathCompleter(), uOptions() ] -- cgit v1.2.3