diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-07-20 11:40:37 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-07-20 11:40:37 +1200 |
commit | 76f0c3ea783dbb46540a3b77b13f7700e9639ea4 (patch) | |
tree | b74e43fd26b647d3e8464c8705e14cdd335f275a /test/test_pathod.py | |
parent | 1bb93176dafc19fc71fde10174ccb00ce7421cb7 (diff) | |
download | mitmproxy-76f0c3ea783dbb46540a3b77b13f7700e9639ea4.tar.gz mitmproxy-76f0c3ea783dbb46540a3b77b13f7700e9639ea4.tar.bz2 mitmproxy-76f0c3ea783dbb46540a3b77b13f7700e9639ea4.zip |
Handle invalid first line errors, add an error log buffer type.
Diffstat (limited to 'test/test_pathod.py')
-rw-r--r-- | test/test_pathod.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/test_pathod.py b/test/test_pathod.py index bf15bc23..902074b7 100644 --- a/test/test_pathod.py +++ b/test/test_pathod.py @@ -1,5 +1,6 @@ import requests from libpathod import pathod, test, version +from netlib import tcp import tutils class _TestApplication: @@ -60,12 +61,22 @@ class TestDaemon: def get(self, spec): return requests.get("http://localhost:%s/p/%s"%(self.d.port, spec)) + def test_invalid_first_line(self): + c = tcp.TCPClient("localhost", self.d.port) + c.connect() + c.wfile.write("foo\n\n\n") + c.wfile.flush() + l = self.d.log()[0] + assert l["type"] == "error" + assert "foo" in l["msg"] + def test_info(self): assert tuple(self.d.info()["version"]) == version.IVERSION def test_logs(self): + l = len(self.d.log()) rsp = self.get("202") - assert len(self.d.log()) == 1 + assert len(self.d.log()) == l+1 assert self.d.clear_log() assert len(self.d.log()) == 0 |