diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test_console.py | 12 | ||||
-rw-r--r-- | test/test_filt.py | 2 | ||||
-rw-r--r-- | test/test_flow.py | 18 | ||||
-rw-r--r-- | test/test_proxy.py | 8 | ||||
-rw-r--r-- | test/utils.py | 4 |
5 files changed, 21 insertions, 23 deletions
diff --git a/test/test_console.py b/test/test_console.py index 98a1270f..179b116d 100644 --- a/test/test_console.py +++ b/test/test_console.py @@ -10,7 +10,7 @@ class uState(libpry.AutoTree): connect -> request -> response """ - bc = proxy.BrowserConnection("address", 22) + bc = proxy.ClientConnection(("address", 22)) c = console.ConsoleState() f = flow.Flow(bc) c.add_browserconnect(f) @@ -25,7 +25,7 @@ class uState(libpry.AutoTree): """ c = console.ConsoleState() - bc = proxy.BrowserConnection("address", 22) + bc = proxy.ClientConnection(("address", 22)) f = flow.Flow(bc) c.add_browserconnect(f) assert c.get_focus() == (f, 0) @@ -33,7 +33,7 @@ class uState(libpry.AutoTree): assert c.get_from_pos(1) == (None, None) assert c.get_next(0) == (None, None) - bc2 = proxy.BrowserConnection("address", 22) + bc2 = proxy.ClientConnection(("address", 22)) f2 = flow.Flow(bc2) c.add_browserconnect(f2) assert c.get_focus() == (f, 1) @@ -54,7 +54,7 @@ class uState(libpry.AutoTree): def _add_request(self, state): f = utils.tflow() state.add_browserconnect(f) - q = utils.treq(f.connection) + q = utils.treq(f.client_conn) state.add_request(q) return f @@ -67,7 +67,7 @@ class uState(libpry.AutoTree): c = console.ConsoleState() f = utils.tflow() c.add_browserconnect(f) - q = utils.treq(f.connection) + q = utils.treq(f.client_conn) c.focus = None assert c.add_request(q) @@ -117,7 +117,7 @@ class uformat_flow(libpry.AutoTree): assert ('method', '[edited] ') in console.format_flow(f, True) assert ('method', '[edited] ') in console.format_flow(f, True, True) - f.connection = flow.ReplayConnection() + f.client_conn = proxy.ClientConnection(None) assert ('method', '[replay] ') in console.format_flow(f, True) assert ('method', '[replay] ') in console.format_flow(f, True, True) diff --git a/test/test_filt.py b/test/test_filt.py index 036c1892..43addd3e 100644 --- a/test/test_filt.py +++ b/test/test_filt.py @@ -72,7 +72,7 @@ class uParsing(libpry.AutoTree): class uMatching(libpry.AutoTree): def req(self): - conn = proxy.BrowserConnection("one", 2222) + conn = proxy.ClientConnection(("one", 2222)) headers = utils.Headers() headers["header"] = ["qvalue"] return proxy.Request( diff --git a/test/test_flow.py b/test/test_flow.py index 59b277e4..9629934f 100644 --- a/test/test_flow.py +++ b/test/test_flow.py @@ -39,8 +39,6 @@ class uFlow(libpry.AutoTree): def test_getset_state(self): f = utils.tflow() - state = f.get_state() - assert f == flow.Flow.from_state(state) f.response = utils.tresp() f.request = f.response.request state = f.get_state() @@ -66,7 +64,7 @@ class uFlow(libpry.AutoTree): assert console.format_flow(f, True) assert console.format_flow(f, False) - f.connection = flow.ReplayConnection() + f.client_conn.set_replay() assert console.format_flow(f, True) assert console.format_flow(f, False) @@ -115,7 +113,7 @@ class uFlow(libpry.AutoTree): class uState(libpry.AutoTree): def test_backup(self): - bc = proxy.BrowserConnection("address", 22) + bc = proxy.ClientConnection(("address", 22)) c = flow.State() f = flow.Flow(bc) c.add_browserconnect(f) @@ -129,7 +127,7 @@ class uState(libpry.AutoTree): connect -> request -> response """ - bc = proxy.BrowserConnection("address", 22) + bc = proxy.ClientConnection(("address", 22)) c = flow.State() f = flow.Flow(bc) c.add_browserconnect(f) @@ -154,14 +152,14 @@ class uState(libpry.AutoTree): assert not c.lookup(newresp) def test_err(self): - bc = proxy.BrowserConnection("address", 22) + bc = proxy.ClientConnection(("address", 22)) c = flow.State() f = flow.Flow(bc) c.add_browserconnect(f) e = proxy.Error(bc, "message") assert c.add_error(e) - e = proxy.Error(proxy.BrowserConnection("address", 22), "message") + e = proxy.Error(proxy.ClientConnection(("address", 22)), "message") assert not c.add_error(e) def test_view(self): @@ -176,7 +174,7 @@ class uState(libpry.AutoTree): f = utils.tflow() - req = utils.treq(f.connection) + req = utils.treq(f.client_conn) c.add_browserconnect(f) c.add_request(req) assert len(c.view) == 2 @@ -188,7 +186,7 @@ class uState(libpry.AutoTree): def _add_request(self, state): f = utils.tflow() state.add_browserconnect(f) - q = utils.treq(f.connection) + q = utils.treq(f.client_conn) state.add_request(q) return f @@ -201,7 +199,7 @@ class uState(libpry.AutoTree): f = utils.tflow() f.error = proxy.Error(None, "msg") state.add_browserconnect(f) - q = utils.treq(f.connection) + q = utils.treq(f.client_conn) state.add_request(q) def test_kill_flow(self): diff --git a/test/test_proxy.py b/test/test_proxy.py index eaf73ee1..340b6697 100644 --- a/test/test_proxy.py +++ b/test/test_proxy.py @@ -221,7 +221,7 @@ class uRequest(libpry.AutoTree): def test_simple(self): h = utils.Headers() h["test"] = ["test"] - c = proxy.BrowserConnection("addr", 2222) + c = proxy.ClientConnection(("addr", 2222)) r = proxy.Request(c, "host", 22, "https", "GET", "/", h, "content") u = r.url() assert r.set_url(u) @@ -233,7 +233,7 @@ class uRequest(libpry.AutoTree): def test_getset_state(self): h = utils.Headers() h["test"] = ["test"] - c = proxy.BrowserConnection("addr", 2222) + c = proxy.ClientConnection(("addr", 2222)) r = proxy.Request(c, "host", 22, "https", "GET", "/", h, "content") state = r.get_state() assert proxy.Request.from_state(state) == r @@ -243,7 +243,7 @@ class uResponse(libpry.AutoTree): def test_simple(self): h = utils.Headers() h["test"] = ["test"] - c = proxy.BrowserConnection("addr", 2222) + c = proxy.ClientConnection(("addr", 2222)) req = proxy.Request(c, "host", 22, "https", "GET", "/", h, "content") resp = proxy.Response(req, 200, "HTTP", "msg", h.copy(), "content") assert resp.short() @@ -252,7 +252,7 @@ class uResponse(libpry.AutoTree): def test_getset_state(self): h = utils.Headers() h["test"] = ["test"] - c = proxy.BrowserConnection("addr", 2222) + c = proxy.ClientConnection(("addr", 2222)) r = proxy.Request(c, "host", 22, "https", "GET", "/", h, "content") req = proxy.Request(c, "host", 22, "https", "GET", "/", h, "content") resp = proxy.Response(req, 200, "HTTP", "msg", h.copy(), "content") diff --git a/test/utils.py b/test/utils.py index d07cb658..94463b6a 100644 --- a/test/utils.py +++ b/test/utils.py @@ -2,7 +2,7 @@ from libmproxy import proxy, utils, filt, flow def treq(conn=None): if not conn: - conn = proxy.BrowserConnection("address", 22) + conn = proxy.ClientConnection(("address", 22)) headers = utils.Headers() headers["header"] = ["qvalue"] return proxy.Request(conn, "host", 80, "http", "GET", "/path", headers, "content") @@ -17,6 +17,6 @@ def tresp(req=None): def tflow(): - bc = proxy.BrowserConnection("address", 22) + bc = proxy.ClientConnection(("address", 22)) return flow.Flow(bc) |