aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-07-25 10:34:57 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-07-25 10:34:57 +1200
commit8cfbc2f80eb186e0958b7fbf7b9f70dca37389f7 (patch)
treec18289e1f5ac0f8d1c9ec958fbe82e24a4b7eff7 /test
parente1df7f47a670e5f2f3cfb27d77efecec1157333e (diff)
downloadmitmproxy-8cfbc2f80eb186e0958b7fbf7b9f70dca37389f7.tar.gz
mitmproxy-8cfbc2f80eb186e0958b7fbf7b9f70dca37389f7.tar.bz2
mitmproxy-8cfbc2f80eb186e0958b7fbf7b9f70dca37389f7.zip
Refactor test.py, add unit tests for app.py corner case.
Diffstat (limited to 'test')
-rw-r--r--test/test_pathod.py13
-rw-r--r--test/tutils.py7
2 files changed, 14 insertions, 6 deletions
diff --git a/test/test_pathod.py b/test/test_pathod.py
index 58477620..036fbf0b 100644
--- a/test/test_pathod.py
+++ b/test/test_pathod.py
@@ -29,15 +29,20 @@ class TestPathod:
class TestNoWeb(tutils.DaemonTests):
noweb = True
- def setUp(self):
- # Over ride log clearing
- pass
-
def test_noweb(self):
assert self.get("200").status_code == 200
assert self.getpath("/").status_code == 800
+class TestNoApi(tutils.DaemonTests):
+ noapi = True
+ def test_noapi(self):
+ assert self.getpath("/log").status_code == 404
+ r = self.getpath("/")
+ assert r.status_code == 200
+ assert not "Log" in r.content
+
+
class CommonTests(tutils.DaemonTests):
def test_sizelimit(self):
r = self.get("200:b@1g")
diff --git a/test/tutils.py b/test/tutils.py
index b1e277e7..1eb78980 100644
--- a/test/tutils.py
+++ b/test/tutils.py
@@ -5,6 +5,7 @@ import requests
class DaemonTests:
noweb = False
+ noapi = False
ssl = False
@classmethod
def setUpAll(self):
@@ -13,7 +14,8 @@ class DaemonTests:
anchors=[("/anchor/.*", "202")],
ssl = self.ssl,
sizelimit=1*1024*1024,
- noweb = self.noweb
+ noweb = self.noweb,
+ noapi = self.noapi
)
@classmethod
@@ -21,7 +23,8 @@ class DaemonTests:
self.d.shutdown()
def setUp(self):
- self.d.clear_log()
+ if not (self.noweb or self.noapi):
+ self.d.clear_log()
def getpath(self, path, params=None):
scheme = "https" if self.ssl else "http"