diff options
author | Shadab Zafar <dufferzafar0@gmail.com> | 2016-02-08 23:06:47 +0530 |
---|---|---|
committer | Shadab Zafar <dufferzafar0@gmail.com> | 2016-02-08 23:31:30 +0530 |
commit | 56892f885b1a306e5f78226c7b7caabccaa5ebcd (patch) | |
tree | ae7f1a7936bb26118b670ff211b9cc1ec7d89357 /test | |
parent | ddeb3731a8f65201321d56c454d55bd00220f057 (diff) | |
download | mitmproxy-56892f885b1a306e5f78226c7b7caabccaa5ebcd.tar.gz mitmproxy-56892f885b1a306e5f78226c7b7caabccaa5ebcd.tar.bz2 mitmproxy-56892f885b1a306e5f78226c7b7caabccaa5ebcd.zip |
Tests for flow_export.raw_request
Diffstat (limited to 'test')
-rw-r--r-- | test/test_export_flow.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/test/test_export_flow.py b/test/test_export_flow.py index 31f2a207..d026e214 100644 --- a/test/test_export_flow.py +++ b/test/test_export_flow.py @@ -4,7 +4,7 @@ from . import tutils req_get = netlib.tutils.treq( method='GET', - content=None, + content='', ) req_post = netlib.tutils.treq( @@ -77,3 +77,25 @@ def test_python_code(): """)\n\n""" """print(response.text)""") assert flow_export.python_code(flow) == result + + +def test_raw_request(): + flow = tutils.tflow(req=req_get) + result = ("""GET /path HTTP/1.1\r\n""" + """header: qvalue\r\n""" + """host: address:22\r\n\r\n""" + """""") + assert flow_export.raw_request(flow) == result + + flow = tutils.tflow(req=req_post) + result = ("""POST /path HTTP/1.1\r\n""" + """host: address:22\r\n\r\n""" + """content""") + assert flow_export.raw_request(flow) == result + + flow = tutils.tflow(req=req_patch) + result = ("""PATCH /path?query=param HTTP/1.1\r\n""" + """header: qvalue\r\n""" + """host: address:22\r\n\r\n""" + """content""") + assert flow_export.raw_request(flow) == result |