| 134 | |
| 135 | |
| 136 | def test_simple(tmp_path): |
| 137 | sa = save.Save() |
| 138 | with taddons.context(sa) as tctx: |
| 139 | p = str(tmp_path / "foo") |
| 140 | |
| 141 | tctx.configure(sa, save_stream_file=p) |
| 142 | |
| 143 | f = tflow.tflow(resp=True) |
| 144 | sa.request(f) |
| 145 | sa.response(f) |
| 146 | tctx.configure(sa, save_stream_file=None) |
| 147 | assert rd(p)[0].response |
| 148 | |
| 149 | tctx.configure(sa, save_stream_file="+" + p) |
| 150 | f = tflow.tflow(err=True) |
| 151 | sa.request(f) |
| 152 | sa.error(f) |
| 153 | tctx.configure(sa, save_stream_file=None) |
| 154 | assert rd(p)[1].error |
| 155 | |
| 156 | tctx.configure(sa, save_stream_file="+" + p) |
| 157 | f = tflow.tflow() |
| 158 | sa.request(f) |
| 159 | tctx.configure(sa, save_stream_file=None) |
| 160 | assert not rd(p)[2].response |
| 161 | |
| 162 | f = tflow.tflow() |
| 163 | sa.response(f) |
| 164 | assert len(rd(p)) == 3 |
| 165 | |
| 166 | |
| 167 | def test_rotate_stream(tmp_path): |