diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2017-02-14 22:48:43 +0100 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2017-02-14 23:31:37 +0100 |
commit | a12c3d3f8ea255dd03bb7e993fa85eb00f47ab29 (patch) | |
tree | 82595e20d3fbbbb568de9178b7645a40fb7b0923 /test/helper_tools/dumperview.py | |
parent | 04748e6f3f654733afafea3701d4ed03b08b8167 (diff) | |
download | mitmproxy-a12c3d3f8ea255dd03bb7e993fa85eb00f47ab29.tar.gz mitmproxy-a12c3d3f8ea255dd03bb7e993fa85eb00f47ab29.tar.bz2 mitmproxy-a12c3d3f8ea255dd03bb7e993fa85eb00f47ab29.zip |
restructure and move test files
add empty test files to satisfy linter
Diffstat (limited to 'test/helper_tools/dumperview.py')
-rwxr-xr-x | test/helper_tools/dumperview.py | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/test/helper_tools/dumperview.py b/test/helper_tools/dumperview.py new file mode 100755 index 00000000..be56fe14 --- /dev/null +++ b/test/helper_tools/dumperview.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +import click + +from mitmproxy.addons import dumper +from mitmproxy.test import tflow +from mitmproxy.test import taddons +from mitmproxy.tools import dump + + +def show(flow_detail, flows): + d = dumper.Dumper() + with taddons.context(options=dump.Options()) as ctx: + ctx.configure(d, flow_detail=flow_detail) + for f in flows: + ctx.cycle(d, f) + + +@click.group() +def cli(): + pass + + +@cli.command() +@click.option('--level', default=1, help='Detail level') +def tcp(level): + f1 = tflow.ttcpflow(client_conn=True, server_conn=True) + show(level, [f1]) + + +@cli.command() +@click.option('--level', default=1, help='Detail level') +def large(level): + f1 = tflow.tflow(client_conn=True, server_conn=True, resp=True) + f1.response.headers["content-type"] = "text/html" + f1.response.content = b"foo bar voing\n" * 100 + show(level, [f1]) + + +@cli.command() +@click.option('--level', default=1, help='Detail level') +def small(level): + f1 = tflow.tflow(client_conn=True, server_conn=True, resp=True) + f1.response.headers["content-type"] = "text/html" + f1.response.content = b"<html><body>Hello!</body></html>" + + f2 = tflow.tflow(client_conn=True, server_conn=True, err=True) + + show( + level, + [ + f1, f2, + ] + ) + + +if __name__ == "__main__": + cli() |