From e99b1d1949c6a140895f8f10c4863ec41528cccf Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Wed, 9 Mar 2011 20:05:30 +1300 Subject: Stub out refresh for server-side replay. --- test/test_proxy.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'test/test_proxy.py') 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"] -- cgit v1.2.3