diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-08-01 11:17:01 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-08-01 11:17:01 +1200 |
commit | 43f1c72511e3f68172ea16f742506693b8feff4c (patch) | |
tree | a7f3afdd7ea9131f463d9586c25bdd66f17f6051 /test/test_flow.py | |
parent | ddb5748a76725ea6a6c6bb58e13b7b8ca09e147b (diff) | |
download | mitmproxy-43f1c72511e3f68172ea16f742506693b8feff4c.tar.gz mitmproxy-43f1c72511e3f68172ea16f742506693b8feff4c.tar.bz2 mitmproxy-43f1c72511e3f68172ea16f742506693b8feff4c.zip |
Refactor the way we calculate views of the flow list.
The naive approach we used before recalculated the view on every access, and
consequently had serious performance problems.
Diffstat (limited to 'test/test_flow.py')
-rw-r--r-- | test/test_flow.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/test_flow.py b/test/test_flow.py index ba276248..ec62f4c8 100644 --- a/test/test_flow.py +++ b/test/test_flow.py @@ -152,7 +152,7 @@ class uFlow(libpry.AutoTree): f.response = tutils.tresp() f.request = f.response.request assert not f.match(filt.parse("~b test")) - assert not f.match(None) + assert f.match(None) def test_backup(self): f = tutils.tflow() @@ -260,23 +260,23 @@ class uState(libpry.AutoTree): f = c.add_request(req) assert f assert c.flow_count() == 1 - assert c.flow_map.get(req) + assert c._flow_map.get(req) assert c.active_flow_count() == 1 newreq = tutils.treq() assert c.add_request(newreq) - assert c.flow_map.get(newreq) + assert c._flow_map.get(newreq) assert c.active_flow_count() == 2 resp = tutils.tresp(req) assert c.add_response(resp) assert c.flow_count() == 2 - assert c.flow_map.get(resp.request) + assert c._flow_map.get(resp.request) assert c.active_flow_count() == 1 unseen_resp = tutils.tresp() assert not c.add_response(unseen_resp) - assert not c.flow_map.get(unseen_resp.request) + assert not c._flow_map.get(unseen_resp.request) assert c.active_flow_count() == 1 resp = tutils.tresp(newreq) @@ -373,7 +373,7 @@ class uState(libpry.AutoTree): c.clear() c.load_flows(flows) - assert isinstance(c.flow_list[0], flow.Flow) + assert isinstance(c._flow_list[0], flow.Flow) def test_accept_all(self): c = flow.State() @@ -418,7 +418,7 @@ class uSerialize(libpry.AutoTree): s = flow.State() fm = flow.FlowMaster(None, s) fm.load_flows(r) - assert len(s.flow_list) == 6 + assert len(s._flow_list) == 6 def test_error(self): |