From 29d800767802ffc17c3577aaebfaf59221e0fb7e Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Wed, 26 Jan 2011 14:52:03 +1300 Subject: Add serialization hooks to flows and flow component objects. --- test/test_proxy.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test/test_proxy.py') diff --git a/test/test_proxy.py b/test/test_proxy.py index 90cfbbfb..ea1c56aa 100644 --- a/test/test_proxy.py +++ b/test/test_proxy.py @@ -225,6 +225,14 @@ class uRequest(libpry.AutoTree): assert r.short() assert r.assemble() + def test_getset_state(self): + h = utils.Headers() + h["test"] = ["test"] + c = proxy.BrowserConnection("addr", 2222) + r = proxy.Request(c, "host", 22, "https", "GET", "/", h, "content") + state = r.get_state() + assert proxy.Request.from_state(state) == r + class uResponse(libpry.AutoTree): def test_simple(self): @@ -236,6 +244,24 @@ class uResponse(libpry.AutoTree): assert resp.short() assert resp.assemble() + def test_getset_state(self): + h = utils.Headers() + h["test"] = ["test"] + c = proxy.BrowserConnection("addr", 2222) + r = proxy.Request(c, "host", 22, "https", "GET", "/", h, "content") + req = proxy.Request(c, "host", 22, "https", "GET", "/", h, "content") + resp = proxy.Response(req, 200, "HTTP", "msg", h.copy(), "content") + + state = resp.get_state() + assert proxy.Response.from_state(req, state) == resp + + +class uError(libpry.AutoTree): + def test_getset_state(self): + e = proxy.Error(None, "Error") + state = e.get_state() + assert proxy.Error.from_state(state) == e + class uProxyError(libpry.AutoTree): def test_simple(self): @@ -252,6 +278,7 @@ tests = [ uConfig(), u_parse_proxy_request(), u_parse_url(), + uError(), _TestServers(), [ uSanity(), uProxy(), -- cgit v1.2.3