aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_console_common.py10
-rw-r--r--test/test_flow.py13
2 files changed, 22 insertions, 1 deletions
diff --git a/test/test_console_common.py b/test/test_console_common.py
new file mode 100644
index 00000000..29bf7b84
--- /dev/null
+++ b/test/test_console_common.py
@@ -0,0 +1,10 @@
+import libmproxy.console.common as common
+from libmproxy import utils, flow, encoding
+import tutils
+
+
+def test_format_flow():
+ f = tutils.tflow_full()
+ assert common.format_flow(f, True)
+ assert common.format_flow(f, True, hostheader=True)
+ assert common.format_flow(f, True, extended=True)
diff --git a/test/test_flow.py b/test/test_flow.py
index c1ae1a9f..fce4e98a 100644
--- a/test/test_flow.py
+++ b/test/test_flow.py
@@ -497,7 +497,7 @@ class TestSerialize:
fm = flow.FlowMaster(None, s)
fm.load_flows(r)
assert len(s._flow_list) == 6
-
+
def test_filter(self):
sio = StringIO()
fl = filt.parse("~c 200")
@@ -783,6 +783,17 @@ class TestRequest:
r.content = flow.CONTENT_MISSING
assert not r._assemble()
+ def test_get_url(self):
+ h = flow.ODictCaseless()
+ h["test"] = ["test"]
+ c = flow.ClientConnect(("addr", 2222))
+ r = flow.Request(c, (1, 1), "host", 22, "https", "GET", "/", h, "content")
+ assert r.get_url() == "https://host:22/"
+ assert r.get_url(hostheader=True) == "https://host:22/"
+ r.headers["Host"] = ["foo.com"]
+ assert r.get_url() == "https://host:22/"
+ assert r.get_url(hostheader=True) == "https://foo.com:22/"
+
def test_path_components(self):
h = flow.ODictCaseless()
c = flow.ClientConnect(("addr", 2222))