aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-06-21 15:39:40 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-06-21 15:39:40 +1200
commitf0fd33fb11513a3e74079eaed5f5c1b8bb4e561d (patch)
treee14e24d4aa5b2ed24a96cc5af87f6ff5ac7e3a91 /test
parent12c140b951705c08131cc4b86a247bccc9c493c0 (diff)
downloadmitmproxy-f0fd33fb11513a3e74079eaed5f5c1b8bb4e561d.tar.gz
mitmproxy-f0fd33fb11513a3e74079eaed5f5c1b8bb4e561d.tar.bz2
mitmproxy-f0fd33fb11513a3e74079eaed5f5c1b8bb4e561d.zip
Log inspection and manipulation from tests.
Diffstat (limited to 'test')
-rw-r--r--test/test_pathod.py16
-rw-r--r--test/test_test.py9
2 files changed, 8 insertions, 17 deletions
diff --git a/test/test_pathod.py b/test/test_pathod.py
index 9c16748d..966ae12e 100644
--- a/test/test_pathod.py
+++ b/test/test_pathod.py
@@ -12,22 +12,6 @@ class _TestApplication:
a.remove_anchor("/oink", "400")
assert a.get_anchors() == [("/foo", "200")]
- def test_logs(self):
- a = pathod.PathodApp(staticdir=None)
- a.LOGBUF = 3
- a.add_log({})
- assert a.log[0]["id"] == 0
- a.add_log({})
- a.add_log({})
- assert a.log[0]["id"] == 2
- a.add_log({})
- assert len(a.log) == 3
- assert a.log[0]["id"] == 3
- assert a.log[-1]["id"] == 1
-
- assert a.log_by_id(1)["id"] == 1
- assert not a.log_by_id(0)
-
class TestPathod:
def test_instantiation(self):
diff --git a/test/test_test.py b/test/test_test.py
index c3743a42..36d77fd5 100644
--- a/test/test_test.py
+++ b/test/test_test.py
@@ -6,7 +6,7 @@ import tutils
logging.disable(logging.CRITICAL)
class TestDaemonManual:
- def test_startstop(self):
+ def test_simple(self):
d = test.Daemon()
rsp = requests.get("http://localhost:%s/p/202"%d.port)
assert rsp.ok
@@ -46,3 +46,10 @@ class TestDaemon:
def test_info(self):
assert tuple(self.d.info()["version"]) == version.IVERSION
+
+ def test_logs(self):
+ rsp = requests.get("http://localhost:%s/p/202"%self.d.port)
+ assert len(self.d.log()) == 1
+ assert self.d.clear_log()
+ assert len(self.d.log()) == 0
+