diff options
author | Shadab Zafar <dufferzafar0@gmail.com> | 2016-06-04 20:56:07 +0530 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-06-06 11:51:36 -0700 |
commit | 9a19540f8b624ad5df80796cf31c92277b1593f0 (patch) | |
tree | 35af58a57c3a102233786d5cf262bc46075b086e /test/pathod | |
parent | 12dd6f6707a6f91cdfa38c19b150b36c54935cc7 (diff) | |
download | mitmproxy-9a19540f8b624ad5df80796cf31c92277b1593f0.tar.gz mitmproxy-9a19540f8b624ad5df80796cf31c92277b1593f0.tar.bz2 mitmproxy-9a19540f8b624ad5df80796cf31c92277b1593f0.zip |
Py3: Use BytesIO instead of StringIO for tests
Diffstat (limited to 'test/pathod')
-rw-r--r-- | test/pathod/test_language_http.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/pathod/test_language_http.py b/test/pathod/test_language_http.py index 32be8a52..9a119d65 100644 --- a/test/pathod/test_language_http.py +++ b/test/pathod/test_language_http.py @@ -1,4 +1,4 @@ -from six.moves import cStringIO as StringIO +from six import BytesIO from pathod import language from pathod.language import http, base import tutils @@ -9,7 +9,7 @@ def parse_request(s): def test_make_error_response(): - d = StringIO() + d = BytesIO() s = http.make_error_response("foo") language.serve(s, d, {}) @@ -75,7 +75,7 @@ class TestRequest: assert r[0].values({}) def test_render(self): - s = StringIO() + s = BytesIO() r = parse_request("GET:'/foo'") assert language.serve( r, @@ -162,7 +162,7 @@ class TestResponse: assert "OK" in [i[:] for i in r.preamble({})] def test_render(self): - s = StringIO() + s = BytesIO() r = next(language.parse_pathod("400:m'msg'")) assert language.serve(r, s, {}) @@ -172,13 +172,13 @@ class TestResponse: assert "p0" not in s.spec() def test_raw(self): - s = StringIO() + s = BytesIO() r = next(language.parse_pathod("400:b'foo'")) language.serve(r, s, {}) v = s.getvalue() assert "Content-Length" in v - s = StringIO() + s = BytesIO() r = next(language.parse_pathod("400:b'foo':r")) language.serve(r, s, {}) v = s.getvalue() @@ -186,7 +186,7 @@ class TestResponse: def test_length(self): def testlen(x): - s = StringIO() + s = BytesIO() x = next(x) language.serve(x, s, language.Settings()) assert x.length(language.Settings()) == len(s.getvalue()) @@ -196,8 +196,8 @@ class TestResponse: def test_maximum_length(self): def testlen(x): - s = StringIO() x = next(x) + s = BytesIO() m = x.maximum_length({}) language.serve(x, s, {}) assert m >= len(s.getvalue()) |