| 44 | |
| 45 | @pytest.mark.parametrize("take", [True, False]) |
| 46 | def test_taken(self, take): |
| 47 | mb = modifybody.ModifyBody() |
| 48 | with taddons.context(mb) as tctx: |
| 49 | tctx.configure(mb, modify_body=["/foo/bar"]) |
| 50 | f = tflow.tflow() |
| 51 | f.request.content = b"foo" |
| 52 | if take: |
| 53 | f.response = tresp() |
| 54 | mb.request(f) |
| 55 | assert (f.request.content == b"bar") ^ take |
| 56 | |
| 57 | f = tflow.tflow(resp=True) |
| 58 | f.response.content = b"foo" |
| 59 | if take: |
| 60 | f.kill() |
| 61 | mb.response(f) |
| 62 | assert (f.response.content == b"bar") ^ take |
| 63 | |
| 64 | def test_order(self): |
| 65 | mb = modifybody.ModifyBody() |