aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_pathod.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2014-10-25 15:30:54 +1300
committerAldo Cortesi <aldo@nullcube.com>2014-10-25 15:30:54 +1300
commit00d0ee5ad56d8243b1e9bfffec9a941e11359d2c (patch)
treedb51a4a1636249ff793b3618f28df5075473cc7e /test/test_pathod.py
parentd6ee5327112182202513ff6ce62d95df1567fdb6 (diff)
downloadmitmproxy-00d0ee5ad56d8243b1e9bfffec9a941e11359d2c.tar.gz
mitmproxy-00d0ee5ad56d8243b1e9bfffec9a941e11359d2c.tar.bz2
mitmproxy-00d0ee5ad56d8243b1e9bfffec9a941e11359d2c.zip
Parse patterns eagerly on instantiation
Diffstat (limited to 'test/test_pathod.py')
-rw-r--r--test/test_pathod.py25
1 files changed, 4 insertions, 21 deletions
diff --git a/test/test_pathod.py b/test/test_pathod.py
index 0172678c..158f3bda 100644
--- a/test/test_pathod.py
+++ b/test/test_pathod.py
@@ -1,28 +1,9 @@
from libpathod import pathod, version
-from netlib import tcp, http, certutils
+from netlib import tcp, http
import tutils
class TestPathod:
- def test_instantiation(self):
- p = pathod.Pathod(
- ("127.0.0.1", 0),
- anchors = [(".*", "200:da")]
- )
- assert p.anchors
- tutils.raises(
- "invalid regex",
- pathod.Pathod,
- ("127.0.0.1", 0),
- anchors=[("*", "200:da")]
- )
- tutils.raises(
- "invalid page spec",
- pathod.Pathod,
- ("127.0.0.1", 0),
- anchors=[("foo", "bar")]
- )
-
def test_logging(self):
p = pathod.Pathod(("127.0.0.1", 0))
assert len(p.get_log()) == 0
@@ -39,6 +20,7 @@ class TestPathod:
class TestNoWeb(tutils.DaemonTests):
noweb = True
+
def test_noweb(self):
assert self.get("200:da").status_code == 200
assert self.getpath("/").status_code == 800
@@ -46,6 +28,7 @@ class TestNoWeb(tutils.DaemonTests):
class TestTimeout(tutils.DaemonTests):
timeout = 0.01
+
def test_noweb(self):
# FIXME: Add float values to spec language, reduce test timeout to
# increase test performance
@@ -55,6 +38,7 @@ class TestTimeout(tutils.DaemonTests):
class TestNoApi(tutils.DaemonTests):
noapi = True
+
def test_noapi(self):
assert self.getpath("/log").status_code == 404
r = self.getpath("/")
@@ -238,4 +222,3 @@ class TestDaemonSSL(CommonTests):
r = self.pathoc(r"get:/p/202")
assert r.status_code == 202
assert self.d.last_log()["cipher"][1] > 0
-