From 613e9a298ec2fc82a4811c35f806d129ff883f2a Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 15 May 2011 11:22:35 +1200 Subject: 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. --- test/test_flow.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/test_flow.py') 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") -- cgit v1.2.3