def test_stream(self): with tutils.tmpdir() as tdir: p = os.path.join(tdir, "foo") def r(): r = io.FlowReader(open(p, "rb")) return list(r.stream()) o = options.Options(outfile=(p, "wb")) m = master.Master(o, proxy.DummyServer()) sa = filestreamer.FileStreamer() m.addons.add(sa) f = tutils.tflow(resp=True) m.request(f) m.response(f) m.addons.remove(sa) assert r()[0].response m.options.outfile = (p, "ab") m.addons.add(sa) f = tutils.tflow() m.request(f) m.addons.remove(sa) assert not r()[1].response
def test_stream(self): with tutils.tmpdir() as tdir: p = os.path.join(tdir, "foo") def r(): r = FlowReader(open(p, "rb")) return list(r.stream()) s = state.State() o = options.Options(outfile=(p, "wb")) m = master.FlowMaster(o, None, s) sa = filestreamer.FileStreamer() m.addons.add(o, sa) f = tutils.tflow(resp=True) self.invoke(m, "request", f) self.invoke(m, "response", f) m.addons.remove(sa) assert r()[0].response m.options.outfile = (p, "ab") m.addons.add(o, sa) f = tutils.tflow() self.invoke(m, "request", f) m.addons.remove(sa) assert not r()[1].response
def default_addons(): return [ anticache.AntiCache(), anticomp.AntiComp(), stickyauth.StickyAuth(), stickycookie.StickyCookie(), script.ScriptLoader(), filestreamer.FileStreamer(), replace.Replace(), setheaders.SetHeaders(), ]
def default_addons(): return [ anticache.AntiCache(), anticomp.AntiComp(), stickyauth.StickyAuth(), stickycookie.StickyCookie(), script.ScriptLoader(), filestreamer.FileStreamer(), # replace.Replace(), setheaders.SetHeaders(), serverplayback.ServerPlayback(), clientplayback.ClientPlayback(), ]