aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_rparse.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-04-28 14:43:57 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-04-28 14:43:57 +1200
commit5fc2a63781e554030da9877e8ee56eccc4c873f6 (patch)
tree797fb8ccb74a577b11ad2f8ef577e68d0b31ab0b /test/test_rparse.py
parent2c8f17eae7b23b7c252bead15ba9bf043f03e8d2 (diff)
downloadmitmproxy-5fc2a63781e554030da9877e8ee56eccc4c873f6.tar.gz
mitmproxy-5fc2a63781e554030da9877e8ee56eccc4c873f6.tar.bz2
mitmproxy-5fc2a63781e554030da9877e8ee56eccc4c873f6.zip
Better internal error pages.
Diffstat (limited to 'test/test_rparse.py')
-rw-r--r--test/test_rparse.py31
1 files changed, 19 insertions, 12 deletions
diff --git a/test/test_rparse.py b/test/test_rparse.py
index 0ee3aae4..8e9da6f0 100644
--- a/test/test_rparse.py
+++ b/test/test_rparse.py
@@ -4,6 +4,17 @@ from libpathod import rparse
rparse.TESTING = True
+class DummyRequest(StringIO.StringIO):
+ def write(self, d, callback=None):
+ StringIO.StringIO.write(self, d)
+ if callback:
+ callback()
+
+ def finish(self):
+ return
+
+
+
class uMisc(libpry.AutoTree):
def test_generators(self):
v = rparse.Value.parseString("val")[0]
@@ -130,8 +141,10 @@ class uMisc(libpry.AutoTree):
r = e.parseString('10')[0]
assert r.msg.val == "Unknown code"
- def test_stub_response(self):
- s = rparse.StubResponse(400, "foo")
+ def test_internal_response(self):
+ d = DummyRequest()
+ s = rparse.InternalResponse(400, "foo")
+ s.render(d)
class uDisconnects(libpry.AutoTree):
@@ -175,6 +188,10 @@ class uPauses(libpry.AutoTree):
class uparse(libpry.AutoTree):
def test_parse_err(self):
libpry.raises(rparse.ParseException, rparse.parse, {}, "400:msg,b:")
+ try:
+ rparse.parse({}, "400:msg,b:")
+ except rparse.ParseException, v:
+ print v.marked()
def test_parse_header(self):
r = rparse.parse({}, "400,h:foo:bar")
@@ -193,16 +210,6 @@ class uparse(libpry.AutoTree):
assert ("random", 10) in r.pauses
-class DummyRequest(StringIO.StringIO):
- def write(self, d, callback=None):
- StringIO.StringIO.write(self, d)
- if callback:
- callback()
-
- def finish(self):
- return
-
-
class uResponse(libpry.AutoTree):
def dummy_response(self):
return rparse.parse({}, "400:msg")