aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_rparse.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-06-21 10:56:30 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-06-21 10:56:30 +1200
commit1089a52f3d16c4fef504586cae18a5d324e8d75c (patch)
tree3616be49d90c63d3366254fa8b6894844c6484c9 /test/test_rparse.py
parentde00497b4098fece043a1550a94e112829bcbceb (diff)
downloadmitmproxy-1089a52f3d16c4fef504586cae18a5d324e8d75c.tar.gz
mitmproxy-1089a52f3d16c4fef504586cae18a5d324e8d75c.tar.bz2
mitmproxy-1089a52f3d16c4fef504586cae18a5d324e8d75c.zip
Disconnect, rest refactoring.
Diffstat (limited to 'test/test_rparse.py')
-rw-r--r--test/test_rparse.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/test_rparse.py b/test/test_rparse.py
index f0db75fd..0813f22e 100644
--- a/test/test_rparse.py
+++ b/test/test_rparse.py
@@ -1,4 +1,4 @@
-import os
+import os, cStringIO
from libpathod import rparse, utils
import tutils
@@ -131,7 +131,7 @@ class TestMisc:
assert r.msg.val == "Unknown code"
def test_internal_response(self):
- d = utils.DummyRequest()
+ d = cStringIO.StringIO()
s = rparse.InternalResponse(400, "foo")
s.serve(d)
@@ -245,7 +245,7 @@ class TestResponse:
def test_write_values_disconnects(self):
r = self.dummy_response()
- s = utils.DummyRequest()
+ s = cStringIO.StringIO()
tst = "foo"*100
r.write_values(s, [tst], [(0, "disconnect")], blocksize=5)
assert not s.getvalue()
@@ -254,7 +254,7 @@ class TestResponse:
tst = "foo"*1025
r = rparse.parse({}, "400'msg'")
- s = utils.DummyRequest()
+ s = cStringIO.StringIO()
r.write_values(s, [tst], [])
assert s.getvalue() == tst
@@ -263,29 +263,29 @@ class TestResponse:
r = rparse.parse({}, "400'msg'")
for i in range(2, 10):
- s = utils.DummyRequest()
+ s = cStringIO.StringIO()
r.write_values(s, [tst], [(2, "pause", 0), (1, "pause", 0)], blocksize=i)
assert s.getvalue() == tst
for i in range(2, 10):
- s = utils.DummyRequest()
+ s = cStringIO.StringIO()
r.write_values(s, [tst], [(1, "pause", 0)], blocksize=i)
assert s.getvalue() == tst
tst = ["".join(str(i) for i in range(10))]*5
for i in range(2, 10):
- s = utils.DummyRequest()
+ s = cStringIO.StringIO()
r.write_values(s, tst[:], [(1, "pause", 0)], blocksize=i)
assert s.getvalue() == "".join(tst)
def test_render(self):
- s = utils.DummyRequest()
+ s = cStringIO.StringIO()
r = rparse.parse({}, "400'msg'")
assert r.serve(s)
def test_length(self):
def testlen(x):
- s = utils.DummyRequest()
+ s = cStringIO.StringIO()
x.serve(s)
assert x.length() == len(s.getvalue())
testlen(rparse.parse({}, "400'msg'"))