diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2016-05-31 19:07:55 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2016-05-31 19:07:55 +1200 |
commit | ec34cae6181d6af0150ac730d70b96104a07e9d5 (patch) | |
tree | 875987f36e83f92ce9a38cd6e22326a948f29609 /test/netlib/test_utils.py | |
parent | 15b2374ef9d6a8cbafdff7c79694921387836ff3 (diff) | |
download | mitmproxy-ec34cae6181d6af0150ac730d70b96104a07e9d5.tar.gz mitmproxy-ec34cae6181d6af0150ac730d70b96104a07e9d5.tar.bz2 mitmproxy-ec34cae6181d6af0150ac730d70b96104a07e9d5.zip |
utils.multipartdecode -> http.multipart.decode
also
utils.parse_content_type -> http.headers.parse_content_type
Diffstat (limited to 'test/netlib/test_utils.py')
-rw-r--r-- | test/netlib/test_utils.py | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/test/netlib/test_utils.py b/test/netlib/test_utils.py index c4ee3c10..b3cc9a0b 100644 --- a/test/netlib/test_utils.py +++ b/test/netlib/test_utils.py @@ -1,7 +1,6 @@ # coding=utf-8 from netlib import utils, tutils -from netlib.http import Headers def test_bidi(): @@ -38,37 +37,6 @@ def test_pretty_size(): assert utils.pretty_size(1024 * 1024) == "1MB" -def test_multipartdecode(): - boundary = 'somefancyboundary' - headers = Headers( - content_type='multipart/form-data; boundary=' + 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).encode() - ) - - form = utils.multipartdecode(headers, content) - - assert len(form) == 2 - assert form[0] == (b"field1", b"value1") - assert form[1] == (b"field2", b"value2") - - -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") |