From c0e846b700af16d9f59369d5e43ad343cca9639b Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Sat, 31 Oct 2020 11:59:51 +0100 Subject: [PATCH] fix invididual test coverage --- test/individual_coverage.py | 5 +---- test/mitmproxy/addons/test_dumper.py | 8 +++++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/test/individual_coverage.py b/test/individual_coverage.py index 54180eaca..a77c3bd5c 100755 --- a/test/individual_coverage.py +++ b/test/individual_coverage.py @@ -26,12 +26,9 @@ def run_tests(src, test, fail): test ]) - if e == 0: - if fail: + if e == 0 and fail: print("FAIL DUE TO UNEXPECTED SUCCESS:", src, "Please remove this file from setup.cfg tool:individual_coverage/exclude.") e = 42 - else: - print("Success:", src) else: if fail: print("Ignoring allowed fail:", src) diff --git a/test/mitmproxy/addons/test_dumper.py b/test/mitmproxy/addons/test_dumper.py index aeed8b114..187656606 100644 --- a/test/mitmproxy/addons/test_dumper.py +++ b/test/mitmproxy/addons/test_dumper.py @@ -125,8 +125,14 @@ def test_echo_body(): d._echo_message(f.response, f) t = sio.getvalue() assert "cut off" in t - sio.truncate(0) + +def test_echo_trailer(): + sio = io.StringIO() + sio_err = io.StringIO() + d = dumper.Dumper(sio, sio_err) + with taddons.context(d) as ctx: + ctx.configure(d, flow_detail=3) f = tflow.tflow(client_conn=True, server_conn=True, resp=True) f.response.headers["content-type"] = "text/html" f.response.headers["transfer-encoding"] = "chunked"