aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_certutils.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2013-08-12 16:03:29 +1200
committerAldo Cortesi <aldo@nullcube.com>2013-08-12 16:03:29 +1200
commit62edceee093dd54956ed5b623dfb4cb8c1309a16 (patch)
tree5ccb3ad51edeca77c7f4ad5f9ea1c237177744ff /test/test_certutils.py
parent2da57ecff0e9572e45663dbad1c5f520e57c531f (diff)
downloadmitmproxy-62edceee093dd54956ed5b623dfb4cb8c1309a16.tar.gz
mitmproxy-62edceee093dd54956ed5b623dfb4cb8c1309a16.tar.bz2
mitmproxy-62edceee093dd54956ed5b623dfb4cb8c1309a16.zip
Revamp dummy cert generation.
We no longer use on-disk storage - we just keep the certs in memory.
Diffstat (limited to 'test/test_certutils.py')
-rw-r--r--test/test_certutils.py14
1 files changed, 3 insertions, 11 deletions
diff --git a/test/test_certutils.py b/test/test_certutils.py
index b335e946..0b4baf75 100644
--- a/test/test_certutils.py
+++ b/test/test_certutils.py
@@ -21,21 +21,16 @@ class TestCertStore:
with tutils.tmpdir() as d:
ca = os.path.join(d, "ca")
assert certutils.dummy_ca(ca)
- c = certutils.CertStore(d)
- c.cleanup()
- assert os.path.exists(d)
+ c = certutils.CertStore()
def test_create_tmp(self):
with tutils.tmpdir() as d:
ca = os.path.join(d, "ca")
assert certutils.dummy_ca(ca)
c = certutils.CertStore()
- assert not c.get_cert("../foo.com", [])
- assert not c.get_cert("foo.com", [])
assert c.get_cert("foo.com", [], ca)
assert c.get_cert("foo.com", [], ca)
assert c.get_cert("*.foo.com", [], ca)
- c.cleanup()
def test_check_domain(self):
c = certutils.CertStore()
@@ -52,15 +47,12 @@ class TestDummyCert:
with tutils.tmpdir() as d:
cacert = os.path.join(d, "cacert")
assert certutils.dummy_ca(cacert)
- p = os.path.join(d, "foo")
- certutils.dummy_cert(
- file(p, "wb"),
+ r = certutils.dummy_cert(
cacert,
"foo.com",
["one.com", "two.com", "*.three.com"]
)
- assert file(p,"rb").read()
-
+ assert r.cn == "foo.com"
class TestSSLCert: