aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-07-21 13:53:41 +1200
committerAldo Cortesi <aldo@nullcube.com>2016-07-21 13:53:41 +1200
commit6750ab899a77dd9b62fa35907edd56f60159a836 (patch)
treeb6e551ef713cfcc13eb34583752ae1ce1e9702e5 /test
parent02acfb1242d126e17a295ff8078ef9a73201c7ca (diff)
parent2b58e153b9762f9620d4cb394614a6244a52fbb2 (diff)
downloadmitmproxy-6750ab899a77dd9b62fa35907edd56f60159a836.tar.gz
mitmproxy-6750ab899a77dd9b62fa35907edd56f60159a836.tar.bz2
mitmproxy-6750ab899a77dd9b62fa35907edd56f60159a836.zip
Merge branch 'flow-export' of https://github.com/dufferzafar/mitmproxy into dufferzafar-flow-export
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_flow_export.py42
1 files changed, 6 insertions, 36 deletions
diff --git a/test/mitmproxy/test_flow_export.py b/test/mitmproxy/test_flow_export.py
index e6d65e40..86ff937d 100644
--- a/test/mitmproxy/test_flow_export.py
+++ b/test/mitmproxy/test_flow_export.py
@@ -1,4 +1,3 @@
-from textwrap import dedent
import re
import netlib.tutils
@@ -70,41 +69,6 @@ class TestExportPythonCode():
python_equals("data/test_flow_export/python_patch.py", export.python_code(flow))
-class TestRawRequest():
- def test_get(self):
- flow = tutils.tflow(req=req_get())
- result = dedent("""
- GET /path?a=foo&a=bar&b=baz HTTP/1.1\r
- header: qvalue\r
- content-length: 7\r
- host: address:22\r
- \r
- """).strip(" ").lstrip()
- assert export.raw_request(flow) == result
-
- def test_post(self):
- flow = tutils.tflow(req=req_post())
- result = dedent("""
- POST /path HTTP/1.1\r
- host: address:22\r
- \r
- content
- """).strip()
- assert export.raw_request(flow) == result
-
- def test_patch(self):
- flow = tutils.tflow(req=req_patch())
- result = dedent("""
- PATCH /path?query=param HTTP/1.1\r
- header: qvalue\r
- content-length: 7\r
- host: address:22\r
- \r
- content
- """).strip()
- assert export.raw_request(flow) == result
-
-
class TestExportLocustCode():
def test_get(self):
flow = tutils.tflow(req=req_get())
@@ -153,3 +117,9 @@ class TestIsJson():
headers = Headers(content_type="application/json")
j = export.is_json(headers, b'{"name": "example", "email": "example@example.com"}')
assert isinstance(j, dict)
+
+
+class TestURL():
+ def test_url(self):
+ flow = tutils.tflow()
+ assert export.url(flow) == "http://address:22/path"