| 39 | assert entry["response"]["content"] == "message" |
| 40 | |
| 41 | def test_contentencode(self, tmpdir): |
| 42 | with taddons.context() as tctx: |
| 43 | a = tctx.script(example_dir.path("complex/jsondump.py")) |
| 44 | path = str(tmpdir.join("jsondump.out")) |
| 45 | content = b"foo" + b"\xff" * 10 |
| 46 | tctx.configure(a, dump_destination=path, dump_encodecontent=True) |
| 47 | |
| 48 | tctx.invoke(a, "response", self.flow(resp_content=content)) |
| 49 | tctx.invoke(a, "done") |
| 50 | with open(path) as inp: |
| 51 | entry = json.loads(inp.readline()) |
| 52 | assert entry["response"]["content"] == base64.b64encode(content).decode( |
| 53 | "utf-8" |
| 54 | ) |
| 55 | |
| 56 | def test_http(self, tmpdir): |
| 57 | with requests_mock.Mocker() as mock: |