| 115 | |
| 116 | |
| 117 | def test_cut_save(tmpdir): |
| 118 | f = str(tmpdir.join("path")) |
| 119 | v = view.View() |
| 120 | c = cut.Cut() |
| 121 | with taddons.context() as tctx: |
| 122 | tctx.master.addons.add(v, c) |
| 123 | v.add([tflow.tflow(resp=True)]) |
| 124 | |
| 125 | tctx.command(c.save, "@all", "request.method", f) |
| 126 | assert qr(f) == b"GET" |
| 127 | tctx.command(c.save, "@all", "request.content", f) |
| 128 | assert qr(f) == b"content" |
| 129 | tctx.command(c.save, "@all", "request.content", "+" + f) |
| 130 | assert qr(f) == b"content\ncontent" |
| 131 | |
| 132 | v.add([tflow.tflow(resp=True)]) |
| 133 | tctx.command(c.save, "@all", "request.method", f) |
| 134 | assert qr(f).splitlines() == [b"GET", b"GET"] |
| 135 | tctx.command(c.save, "@all", "request.method,request.content", f) |
| 136 | assert qr(f).splitlines() == [b"GET,b'content'", b"GET,b'content'"] |
| 137 | |
| 138 | |
| 139 | @pytest.mark.parametrize( |