diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2014-03-02 13:45:35 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2014-03-02 13:45:35 +1300 |
commit | 091e539a0203ca272e3a4ba2a9f23331bbd85005 (patch) | |
tree | ca907e8b2983360d666d134a5000cb6a26be6512 /test/test_pathod.py | |
parent | a1d0da2b533b986967a8714c02d567c943d11929 (diff) | |
download | mitmproxy-091e539a0203ca272e3a4ba2a9f23331bbd85005.tar.gz mitmproxy-091e539a0203ca272e3a4ba2a9f23331bbd85005.tar.bz2 mitmproxy-091e539a0203ca272e3a4ba2a9f23331bbd85005.zip |
Big improvements to SSL handling
- pathod now dynamically generates SSL certs, using the ~/.mitmproxy
cacert
- pathoc returns data on SSL peer certificates
- Pathod certificate CN can be specified on command line
- Support SSLv23
Diffstat (limited to 'test/test_pathod.py')
-rw-r--r-- | test/test_pathod.py | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/test/test_pathod.py b/test/test_pathod.py index 9ab6d66d..6fc31677 100644 --- a/test/test_pathod.py +++ b/test/test_pathod.py @@ -1,3 +1,4 @@ +import pprint from libpathod import pathod, version from netlib import tcp, http import requests @@ -54,12 +55,26 @@ class TestNoApi(tutils.DaemonTests): class TestNotAfterConnect(tutils.DaemonTests): ssl = False - not_after_connect = True + ssloptions = dict( + not_after_connect = True + ) def test_connect(self): r = self.pathoc(r"get:'http://foo.com/p/202':da", connect_to=("localhost", self.d.port)) assert r.status_code == 202 +class TestSSLCN(tutils.DaemonTests): + ssl = True + ssloptions = dict( + cn = "foo.com" + ) + def test_connect(self): + r = self.pathoc(r"get:/p/202") + assert r.status_code == 202 + assert r.sslinfo + assert r.sslinfo.certchain[0].get_subject().CN == "foo.com" + + class TestNohang(tutils.DaemonTests): nohang = True def test_nohang(self): @@ -159,11 +174,20 @@ class CommonTests(tutils.DaemonTests): class TestDaemon(CommonTests): ssl = False def test_connect(self): - r = self.pathoc(r"get:'http://foo.com/p/202':da", connect_to=("localhost", self.d.port), ssl=True) + r = self.pathoc( + r"get:'http://foo.com/p/202':da", + connect_to=("localhost", self.d.port), + ssl=True + ) assert r.status_code == 202 def test_connect_err(self): - tutils.raises(http.HttpError, self.pathoc, r"get:'http://foo.com/p/202':da", connect_to=("localhost", self.d.port)) + tutils.raises( + http.HttpError, + self.pathoc, + r"get:'http://foo.com/p/202':da", + connect_to=("localhost", self.d.port) + ) class TestDaemonSSL(CommonTests): @@ -182,5 +206,3 @@ class TestDaemonSSL(CommonTests): assert l["type"] == "error" assert "SSL" in l["msg"] - - |