aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_certutils.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2014-03-04 14:12:58 +1300
committerAldo Cortesi <aldo@nullcube.com>2014-03-04 14:12:58 +1300
commit7c82418e0baca311487230074655f5f106bcdd2b (patch)
tree35bee76de49c755f58637e78914f9882dbab789b /test/test_certutils.py
parentd56f7fba806e6c2008c40df9b0b290b81189cb92 (diff)
downloadmitmproxy-7c82418e0baca311487230074655f5f106bcdd2b.tar.gz
mitmproxy-7c82418e0baca311487230074655f5f106bcdd2b.tar.bz2
mitmproxy-7c82418e0baca311487230074655f5f106bcdd2b.zip
Beef up CertStore, add DH params.
Diffstat (limited to 'test/test_certutils.py')
-rw-r--r--test/test_certutils.py39
1 files changed, 14 insertions, 25 deletions
diff --git a/test/test_certutils.py b/test/test_certutils.py
index 4fab69e6..f741bdec 100644
--- a/test/test_certutils.py
+++ b/test/test_certutils.py
@@ -3,43 +3,32 @@ from netlib import certutils
import tutils
-def test_dummy_ca():
- with tutils.tmpdir() as d:
- path = os.path.join(d, "foo/cert.cnf")
- assert certutils.dummy_ca(path)
- assert os.path.exists(path)
-
- path = os.path.join(d, "foo/cert2.pem")
- assert certutils.dummy_ca(path)
- assert os.path.exists(path)
- assert os.path.exists(os.path.join(d, "foo/cert2-cert.pem"))
- assert os.path.exists(os.path.join(d, "foo/cert2-cert.p12"))
-
-
class TestCertStore:
def test_create_explicit(self):
with tutils.tmpdir() as d:
- ca = os.path.join(d, "ca")
- assert certutils.dummy_ca(ca)
- c = certutils.CertStore(ca)
+ ca = certutils.CertStore.from_store(d, "test")
+ assert ca.get_cert("foo", [])
+
+ ca2 = certutils.CertStore.from_store(d, "test")
+ assert ca2.get_cert("foo", [])
+
+ assert ca.cert.get_serial_number() == ca2.cert.get_serial_number()
def test_create_tmp(self):
with tutils.tmpdir() as d:
- ca = os.path.join(d, "ca")
- assert certutils.dummy_ca(ca)
- c = certutils.CertStore(ca)
- assert c.get_cert("foo.com", [])
- assert c.get_cert("foo.com", [])
- assert c.get_cert("*.foo.com", [])
+ ca = certutils.CertStore.from_store(d, "test")
+ assert ca.get_cert("foo.com", [])
+ assert ca.get_cert("foo.com", [])
+ assert ca.get_cert("*.foo.com", [])
class TestDummyCert:
def test_with_ca(self):
with tutils.tmpdir() as d:
- cacert = os.path.join(d, "cacert")
- assert certutils.dummy_ca(cacert)
+ ca = certutils.CertStore.from_store(d, "test")
r = certutils.dummy_cert(
- cacert,
+ ca.pkey,
+ ca.cert,
"foo.com",
["one.com", "two.com", "*.three.com"]
)