diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-06-28 14:29:15 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-06-28 14:29:15 +1200 |
commit | 47651b1ff2e5dd0c788d744dc1b1d5587107f71a (patch) | |
tree | 85234e13bb15cef993f4147ff33e99a72908800e /test | |
parent | 243e0efefc2ae6842a2d03c7d0a0e648802515b1 (diff) | |
download | mitmproxy-47651b1ff2e5dd0c788d744dc1b1d5587107f71a.tar.gz mitmproxy-47651b1ff2e5dd0c788d744dc1b1d5587107f71a.tar.bz2 mitmproxy-47651b1ff2e5dd0c788d744dc1b1d5587107f71a.zip |
Serialization and de-serialization of new cert format.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_flow.py | 12 | ||||
-rw-r--r-- | test/tutils.py | 4 |
2 files changed, 4 insertions, 12 deletions
diff --git a/test/test_flow.py b/test/test_flow.py index 89577ddb..1394a668 100644 --- a/test/test_flow.py +++ b/test/test_flow.py @@ -2,6 +2,7 @@ import Queue, time from cStringIO import StringIO import email.utils from libmproxy import filt, flow, controller, utils, tnetstring +from netlib import certutils import tutils import libpry @@ -865,17 +866,6 @@ class TestResponse: c = "MOO=BAR; Expires=Tue, 08-Mar-2011 00:20:38 GMT; Path=foo.com; Secure" assert "00:21:38" in r._refresh_cookie(c, 60) - def test_get_cert(self): - req = tutils.treq() - resp = flow.Response( - req, (1, 1), 200, "msg", flow.ODictCaseless(), "content", - file(tutils.test_data.path("data/dercert")).read() - ) - assert resp.get_cert() - - resp = tutils.tresp() - assert not resp.get_cert() - def test_getset_state(self): h = flow.ODictCaseless() h["test"] = ["test"] diff --git a/test/tutils.py b/test/tutils.py index da1cf662..79a1da39 100644 --- a/test/tutils.py +++ b/test/tutils.py @@ -2,6 +2,7 @@ import threading, Queue, time import os, shutil, tempfile from contextlib import contextmanager from libmproxy import proxy, flow, controller, utils +from netlib import certutils import human_curl as hurl import libpathod.test import random @@ -19,7 +20,8 @@ def tresp(req=None): req = treq() headers = flow.ODictCaseless() headers["header_response"] = ["svalue"] - return flow.Response(req, (1, 1), 200, "message", headers, "content_response", None) + cert = certutils.SSLCert.from_der(file(test_data.path("data/dercert")).read()) + return flow.Response(req, (1, 1), 200, "message", headers, "content_response", cert) def tflow(): |