diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-05-15 11:22:35 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-05-15 11:22:35 +1200 |
commit | 613e9a298ec2fc82a4811c35f806d129ff883f2a (patch) | |
tree | 7c505738f11353fd3d8dff7cedd270f063299725 /test/test_flow.py | |
parent | 6175d92583f564d85ff8a59656977e6372f9dc09 (diff) | |
download | mitmproxy-613e9a298ec2fc82a4811c35f806d129ff883f2a.tar.gz mitmproxy-613e9a298ec2fc82a4811c35f806d129ff883f2a.tar.bz2 mitmproxy-613e9a298ec2fc82a4811c35f806d129ff883f2a.zip |
Add a new flow loading mechanism.
We now simulate the normal connection flow when we load flows. That means
that we can run scripts, hooks, sticky cookies, etc.
Diffstat (limited to 'test/test_flow.py')
-rw-r--r-- | test/test_flow.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/test_flow.py b/test/test_flow.py index a6489462..b7a368d2 100644 --- a/test/test_flow.py +++ b/test/test_flow.py @@ -369,6 +369,19 @@ class uState(libpry.AutoTree): class uSerialize(libpry.AutoTree): + def _treader(self): + sio = StringIO() + w = flow.FlowWriter(sio) + for i in range(3): + f = tutils.tflow_full() + w.add(f) + for i in range(3): + f = tutils.tflow_err() + w.add(f) + + sio.seek(0) + return flow.FlowReader(sio) + def test_roundtrip(self): sio = StringIO() f = tutils.tflow() @@ -381,6 +394,14 @@ class uSerialize(libpry.AutoTree): assert len(l) == 1 assert l[0] == f + def test_load_flows(self): + r = self._treader() + s = flow.State() + fm = flow.FlowMaster(None, s) + fm.load_flows(r) + assert len(s.flow_list) == 6 + + def test_error(self): sio = StringIO() sio.write("bogus") |