diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-01-31 11:48:53 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-01-31 11:48:53 +1300 |
commit | edb8228dd27c3050f45b536b761eab46672f8eb3 (patch) | |
tree | 5dd13ff6fbe4cd72302dc173f2b3fa1b36dd3ce8 /test/utils.py | |
parent | 152b97fa0bc9245ccb17353494d5c940b5356d28 (diff) | |
download | mitmproxy-edb8228dd27c3050f45b536b761eab46672f8eb3.tar.gz mitmproxy-edb8228dd27c3050f45b536b761eab46672f8eb3.tar.bz2 mitmproxy-edb8228dd27c3050f45b536b761eab46672f8eb3.zip |
Factor out flow unit tests into speparate file.
Diffstat (limited to 'test/utils.py')
-rw-r--r-- | test/utils.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/utils.py b/test/utils.py new file mode 100644 index 00000000..d07cb658 --- /dev/null +++ b/test/utils.py @@ -0,0 +1,22 @@ +from libmproxy import proxy, utils, filt, flow + +def treq(conn=None): + if not conn: + conn = proxy.BrowserConnection("address", 22) + headers = utils.Headers() + headers["header"] = ["qvalue"] + return proxy.Request(conn, "host", 80, "http", "GET", "/path", headers, "content") + + +def tresp(req=None): + if not req: + req = treq() + headers = utils.Headers() + headers["header_response"] = ["svalue"] + return proxy.Response(req, 200, "HTTP/1.1", "message", headers, "content_response") + + +def tflow(): + bc = proxy.BrowserConnection("address", 22) + return flow.Flow(bc) + |