aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_proxy.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2011-03-09 20:05:30 +1300
committerAldo Cortesi <aldo@nullcube.com>2011-03-09 20:05:30 +1300
commite99b1d1949c6a140895f8f10c4863ec41528cccf (patch)
treed537fd7ebfdeb7b2001d0ecda723ef486b0d7475 /test/test_proxy.py
parent03f13453856e3af15dc3af81adcf3a80d1358da0 (diff)
downloadmitmproxy-e99b1d1949c6a140895f8f10c4863ec41528cccf.tar.gz
mitmproxy-e99b1d1949c6a140895f8f10c4863ec41528cccf.tar.bz2
mitmproxy-e99b1d1949c6a140895f8f10c4863ec41528cccf.zip
Stub out refresh for server-side replay.
Diffstat (limited to 'test/test_proxy.py')
-rw-r--r--test/test_proxy.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/test_proxy.py b/test/test_proxy.py
index 3bc5bcdb..a449071c 100644
--- a/test/test_proxy.py
+++ b/test/test_proxy.py
@@ -1,6 +1,7 @@
-import cStringIO
+import cStringIO, time
import libpry
from libmproxy import proxy, controller, utils, dump, script
+import email.utils
import tutils
@@ -114,6 +115,23 @@ class uResponse(libpry.AutoTree):
resp = proxy.Response(req, 200, "msg", h.copy(), "content")
assert resp.assemble()
+ def test_refresh(self):
+ r = tutils.tresp()
+ n = time.time()
+ r.headers["date"] = [email.utils.formatdate(n)]
+ pre = r.headers["date"]
+ r.refresh(n)
+ assert pre == r.headers["date"]
+ r.refresh(n+60)
+
+ d = email.utils.parsedate_tz(r.headers["date"][0])
+ d = email.utils.mktime_tz(d)
+ # Weird that this is not exact...
+ assert abs(60-(d-n)) <= 1
+
+ r.headers["set-cookie"] = ["MOO=BAR; Expires=Tue, 08-Mar-2011 00:20:38 GMT; Path=foo.com; Secure"]
+ r.refresh()
+
def test_getset_state(self):
h = utils.Headers()
h["test"] = ["test"]