diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-03-20 19:40:03 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-03-20 19:40:03 +0100 |
commit | 88d365cfe671bc5c8d96e78334337aa84cc815da (patch) | |
tree | 21a9bfd946cc5b8958d1b3549a277b51a456ba19 /test/pathod/test_language_http.py | |
parent | 61a657fe56949732d6470862c2ebbe09141f85f2 (diff) | |
download | mitmproxy-88d365cfe671bc5c8d96e78334337aa84cc815da.tar.gz mitmproxy-88d365cfe671bc5c8d96e78334337aa84cc815da.tar.bz2 mitmproxy-88d365cfe671bc5c8d96e78334337aa84cc815da.zip |
py3++: cStringIO
Diffstat (limited to 'test/pathod/test_language_http.py')
-rw-r--r-- | test/pathod/test_language_http.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/test/pathod/test_language_http.py b/test/pathod/test_language_http.py index fd60c9fd..d1870a63 100644 --- a/test/pathod/test_language_http.py +++ b/test/pathod/test_language_http.py @@ -1,5 +1,4 @@ -import cStringIO - +from six.moves import cStringIO as StringIO from pathod import language from pathod.language import http, base import tutils @@ -10,7 +9,7 @@ def parse_request(s): def test_make_error_response(): - d = cStringIO.StringIO() + d = StringIO() s = http.make_error_response("foo") language.serve(s, d, {}) @@ -76,7 +75,7 @@ class TestRequest: assert r[0].values({}) def test_render(self): - s = cStringIO.StringIO() + s = StringIO() r = parse_request("GET:'/foo'") assert language.serve( r, @@ -163,7 +162,7 @@ class TestResponse: assert "OK" in [i[:] for i in r.preamble({})] def test_render(self): - s = cStringIO.StringIO() + s = StringIO() r = language.parse_pathod("400:m'msg'").next() assert language.serve(r, s, {}) @@ -173,13 +172,13 @@ class TestResponse: assert "p0" not in s.spec() def test_raw(self): - s = cStringIO.StringIO() + s = StringIO() r = language.parse_pathod("400:b'foo'").next() language.serve(r, s, {}) v = s.getvalue() assert "Content-Length" in v - s = cStringIO.StringIO() + s = StringIO() r = language.parse_pathod("400:b'foo':r").next() language.serve(r, s, {}) v = s.getvalue() @@ -187,7 +186,7 @@ class TestResponse: def test_length(self): def testlen(x): - s = cStringIO.StringIO() + s = StringIO() x = x.next() language.serve(x, s, language.Settings()) assert x.length(language.Settings()) == len(s.getvalue()) @@ -198,7 +197,7 @@ class TestResponse: def test_maximum_length(self): def testlen(x): x = x.next() - s = cStringIO.StringIO() + s = StringIO() m = x.maximum_length({}) language.serve(x, s, {}) assert m >= len(s.getvalue()) |