diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-08-09 22:15:58 +0200 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-08-10 21:04:17 +0200 |
commit | 891fa50e554963ef7cf236b087cfbedfaf19849e (patch) | |
tree | f6d0347829b3cc7d35027083655b0de3762cef74 /test | |
parent | a10c31c6984f9b6646d2a7bad05ace912ea152a7 (diff) | |
download | mitmproxy-891fa50e554963ef7cf236b087cfbedfaf19849e.tar.gz mitmproxy-891fa50e554963ef7cf236b087cfbedfaf19849e.tar.bz2 mitmproxy-891fa50e554963ef7cf236b087cfbedfaf19849e.zip |
move code to netlib
Diffstat (limited to 'test')
-rw-r--r-- | test/test_protocol_http.py | 19 | ||||
-rw-r--r-- | test/test_utils.py | 28 |
2 files changed, 1 insertions, 46 deletions
diff --git a/test/test_protocol_http.py b/test/test_protocol_http.py index 81c39f09..2da54093 100644 --- a/test/test_protocol_http.py +++ b/test/test_protocol_http.py @@ -11,27 +11,12 @@ from netlib.http.semantics import CONTENT_MISSING import tutils import tservers -def mock_protocol(data='', chunked=False): +def mock_protocol(data=''): rfile = cStringIO.StringIO(data) wfile = cStringIO.StringIO() return http1.HTTP1Protocol(rfile=rfile, wfile=wfile) -# TODO: move test to netlib http1 protocol -# def test_stripped_chunked_encoding_no_content(): -# """ -# https://github.com/mitmproxy/mitmproxy/issues/186 -# """ -# r = tutils.tresp(content="") -# r.headers["Transfer-Encoding"] = ["chunked"] -# assert "Content-Length" in r._assemble_headers() -# -# r = tutils.treq(content="") -# r.headers["Transfer-Encoding"] = ["chunked"] -# assert "Content-Length" in r._assemble_headers() -# - - class TestHTTPResponse: def test_read_from_stringio(self): s = "HTTP/1.1 200 OK\r\n" \ @@ -58,8 +43,6 @@ class TestHTTPResponse: ) - - class TestHTTPFlow(object): def test_repr(self): f = tutils.tflow(resp=True, err=True) diff --git a/test/test_utils.py b/test/test_utils.py index 0ee23b97..0cda23b4 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -44,25 +44,6 @@ def test_pretty_json(): assert not utils.pretty_json("moo") -def test_multipartdecode(): - boundary = 'somefancyboundary' - headers = odict.ODict( - [('content-type', ('multipart/form-data; boundary=%s' % boundary))]) - content = "--{0}\n" \ - "Content-Disposition: form-data; name=\"field1\"\n\n" \ - "value1\n" \ - "--{0}\n" \ - "Content-Disposition: form-data; name=\"field2\"\n\n" \ - "value2\n" \ - "--{0}--".format(boundary) - - form = utils.multipartdecode(headers, content) - - assert len(form) == 2 - assert form[0] == ('field1', 'value1') - assert form[1] == ('field2', 'value2') - - def test_pretty_duration(): assert utils.pretty_duration(0.00001) == "0ms" assert utils.pretty_duration(0.0001) == "0ms" @@ -121,14 +102,5 @@ def test_parse_size(): tutils.raises(ValueError, utils.parse_size, "ak") -def test_parse_content_type(): - p = utils.parse_content_type - assert p("text/html") == ("text", "html", {}) - assert p("text") is None - - v = p("text/html; charset=UTF-8") - assert v == ('text', 'html', {'charset': 'UTF-8'}) - - def test_safe_subn(): assert utils.safe_subn("foo", u"bar", "\xc2foo") |