diff options
author | Stephen Altamirano <stephen@evilrobotstuff.com> | 2011-07-26 22:38:42 -0700 |
---|---|---|
committer | Stephen Altamirano <stephen@evilrobotstuff.com> | 2011-07-26 22:38:42 -0700 |
commit | acd511f6767cdcc332851e44a62fbd843399446a (patch) | |
tree | 37e8629c49aac1fdc9a846732d5d257a46ba70f2 /test | |
parent | c1eaa9f74c9cf3edc34ced3ab441aede4d0bed01 (diff) | |
download | mitmproxy-acd511f6767cdcc332851e44a62fbd843399446a.tar.gz mitmproxy-acd511f6767cdcc332851e44a62fbd843399446a.tar.bz2 mitmproxy-acd511f6767cdcc332851e44a62fbd843399446a.zip |
Adds test method for Response encoding and decoding
Diffstat (limited to 'test')
-rw-r--r-- | test/test_proxy.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/test_proxy.py b/test/test_proxy.py index dacdbcc3..1f63f3b3 100644 --- a/test/test_proxy.py +++ b/test/test_proxy.py @@ -203,6 +203,31 @@ class uResponse(libpry.AutoTree): assert not "foo" in r.content assert r.headers["boo"] == ["boo"] + def test_decodeencode(self): + r = tutils.tresp() + r.headers["content-encoding"] = ["identity"] + r.content = "falafel" + r.decode() + assert r.headers["content-encoding"] == ["identity"] + assert r.content == "falafel" + + r = tutils.tresp() + r.headers["content-encoding"] = ["identity"] + r.content = "falafel" + r.encode("identity") + assert r.headers["content-encoding"] == ["identity"] + assert r.content == "falafel" + + r = tutils.tresp() + r.headers["content-encoding"] = ["identity"] + r.content = "falafel" + r.encode("gzip") + assert r.headers["content-encoding"] == ["gzip"] + assert r.content != "falafel" + r.decode() + assert r.headers["content-encoding"] == ["identity"] + assert r.content == "falafel" + class uError(libpry.AutoTree): def test_getset_state(self): |