aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Altamirano <stephen@evilrobotstuff.com>2011-07-26 22:38:42 -0700
committerStephen Altamirano <stephen@evilrobotstuff.com>2011-07-26 22:38:42 -0700
commitacd511f6767cdcc332851e44a62fbd843399446a (patch)
tree37e8629c49aac1fdc9a846732d5d257a46ba70f2
parentc1eaa9f74c9cf3edc34ced3ab441aede4d0bed01 (diff)
downloadmitmproxy-acd511f6767cdcc332851e44a62fbd843399446a.tar.gz
mitmproxy-acd511f6767cdcc332851e44a62fbd843399446a.tar.bz2
mitmproxy-acd511f6767cdcc332851e44a62fbd843399446a.zip
Adds test method for Response encoding and decoding
-rw-r--r--test/test_proxy.py25
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):