| 23 | assert "Streamed bodies will not be modified" in caplog.text |
| 24 | |
| 25 | def test_simple(self): |
| 26 | mb = modifybody.ModifyBody() |
| 27 | with taddons.context(mb) as tctx: |
| 28 | tctx.configure( |
| 29 | mb, |
| 30 | modify_body=[ |
| 31 | "/~q/foo/bar", |
| 32 | "/~s/foo/bar", |
| 33 | ], |
| 34 | ) |
| 35 | f = tflow.tflow() |
| 36 | f.request.content = b"foo" |
| 37 | mb.request(f) |
| 38 | assert f.request.content == b"bar" |
| 39 | |
| 40 | f = tflow.tflow(resp=True) |
| 41 | f.response.content = b"foo" |
| 42 | mb.response(f) |
| 43 | assert f.response.content == b"bar" |
| 44 | |
| 45 | @pytest.mark.parametrize("take", [True, False]) |
| 46 | def test_taken(self, take): |