mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
100% test coverage.
This commit is contained in:
parent
43314c77c8
commit
e26aac1d3c
@ -65,8 +65,10 @@ class Pathoc(tcp.TCPClient):
|
||||
return
|
||||
except tcp.NetLibTimeout:
|
||||
print >> fp, "<<", "Timeout"
|
||||
except tcp.NetLibDisconnect:
|
||||
return
|
||||
except tcp.NetLibDisconnect: # pragma: nocover
|
||||
print >> fp, "<<", "Disconnect"
|
||||
return
|
||||
else:
|
||||
if respdump:
|
||||
print_full(fp, *resp)
|
||||
|
@ -9,9 +9,6 @@ class PathodError(Exception): pass
|
||||
class PathodHandler(tcp.BaseHandler):
|
||||
wbufsize = 0
|
||||
sni = None
|
||||
def debug(self, s):
|
||||
logging.debug("%s:%s: %s"%(self.client_address[0], self.client_address[1], str(s)))
|
||||
|
||||
def info(self, s):
|
||||
logging.info("%s:%s: %s"%(self.client_address[0], self.client_address[1], str(s)))
|
||||
|
||||
|
@ -57,3 +57,4 @@ class TestDaemon:
|
||||
d = tutils.test_data.path("data/request")
|
||||
assert "foo" in self.tval(["+%s"%d])
|
||||
assert "File" in self.tval(["+/nonexistent"])
|
||||
|
||||
|
@ -107,6 +107,12 @@ class CommonTests(tutils.DaemonTests):
|
||||
assert l["type"] == "error"
|
||||
assert "Invalid" in l["msg"]
|
||||
|
||||
def test_invalid_headers(self):
|
||||
tutils.raises(http.HttpError, self.pathoc, "get:/:h'\t'='foo'")
|
||||
l = self.d.log()[0]
|
||||
assert l["type"] == "error"
|
||||
assert "Invalid headers" in l["msg"]
|
||||
|
||||
def test_access_denied(self):
|
||||
rsp = self.get("=nonexistent")
|
||||
assert rsp.status_code == 800
|
||||
|
Loading…
Reference in New Issue
Block a user