aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2018-01-06 10:50:26 +0100
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2018-01-07 19:55:04 +0100
commit4fb894cad4cf1c1d4a89eef8af35d4523a198f28 (patch)
treea78dfb5fcfd29e54a06b47bb29b51cfc0ca9b4dd /test
parentd15e96dee1d6c3c752434663bf6ea8a547d09d28 (diff)
downloadmitmproxy-4fb894cad4cf1c1d4a89eef8af35d4523a198f28.tar.gz
mitmproxy-4fb894cad4cf1c1d4a89eef8af35d4523a198f28.tar.bz2
mitmproxy-4fb894cad4cf1c1d4a89eef8af35d4523a198f28.zip
avoid TLS/SSL ambiguity for Cert class
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/addons/test_cut.py2
-rw-r--r--test/mitmproxy/proxy/test_server.py14
-rw-r--r--test/mitmproxy/test_certs.py14
3 files changed, 15 insertions, 15 deletions
diff --git a/test/mitmproxy/addons/test_cut.py b/test/mitmproxy/addons/test_cut.py
index cbcc8a8c..c444b8ee 100644
--- a/test/mitmproxy/addons/test_cut.py
+++ b/test/mitmproxy/addons/test_cut.py
@@ -55,7 +55,7 @@ def test_extract():
with open(tutils.test_data.path("mitmproxy/net/data/text_cert"), "rb") as f:
d = f.read()
- c1 = certs.SSLCert.from_pem(d)
+ c1 = certs.Cert.from_pem(d)
tf.server_conn.cert = c1
assert "CERTIFICATE" in cut.extract("server_conn.cert", tf)
diff --git a/test/mitmproxy/proxy/test_server.py b/test/mitmproxy/proxy/test_server.py
index 62b93892..56b7b4c9 100644
--- a/test/mitmproxy/proxy/test_server.py
+++ b/test/mitmproxy/proxy/test_server.py
@@ -143,9 +143,9 @@ class TcpMixin:
# Test that we get the original SSL cert
if self.ssl:
- i_cert = certs.SSLCert(i.sslinfo.certchain[0])
- i2_cert = certs.SSLCert(i2.sslinfo.certchain[0])
- n_cert = certs.SSLCert(n.sslinfo.certchain[0])
+ i_cert = certs.Cert(i.sslinfo.certchain[0])
+ i2_cert = certs.Cert(i2.sslinfo.certchain[0])
+ n_cert = certs.Cert(n.sslinfo.certchain[0])
assert i_cert == i2_cert
assert i_cert != n_cert
@@ -188,9 +188,9 @@ class TcpMixin:
# Test that we get the original SSL cert
if self.ssl:
- i_cert = certs.SSLCert(i.sslinfo.certchain[0])
- i2_cert = certs.SSLCert(i2.sslinfo.certchain[0])
- n_cert = certs.SSLCert(n.sslinfo.certchain[0])
+ i_cert = certs.Cert(i.sslinfo.certchain[0])
+ i2_cert = certs.Cert(i2.sslinfo.certchain[0])
+ n_cert = certs.Cert(n.sslinfo.certchain[0])
assert i_cert == i2_cert
assert i_cert != n_cert
@@ -1149,7 +1149,7 @@ class AddUpstreamCertsToClientChainMixin:
def test_add_upstream_certs_to_client_chain(self):
with open(self.servercert, "rb") as f:
d = f.read()
- upstreamCert = certs.SSLCert.from_pem(d)
+ upstreamCert = certs.Cert.from_pem(d)
p = self.pathoc()
with p.connect():
upstream_cert_found_in_client_chain = False
diff --git a/test/mitmproxy/test_certs.py b/test/mitmproxy/test_certs.py
index 693bebc6..dcc185c0 100644
--- a/test/mitmproxy/test_certs.py
+++ b/test/mitmproxy/test_certs.py
@@ -136,18 +136,18 @@ class TestDummyCert:
assert r.altnames == []
-class TestSSLCert:
+class TestCert:
def test_simple(self):
with open(tutils.test_data.path("mitmproxy/net/data/text_cert"), "rb") as f:
d = f.read()
- c1 = certs.SSLCert.from_pem(d)
+ c1 = certs.Cert.from_pem(d)
assert c1.cn == b"google.com"
assert len(c1.altnames) == 436
with open(tutils.test_data.path("mitmproxy/net/data/text_cert_2"), "rb") as f:
d = f.read()
- c2 = certs.SSLCert.from_pem(d)
+ c2 = certs.Cert.from_pem(d)
assert c2.cn == b"www.inode.co.nz"
assert len(c2.altnames) == 2
assert c2.digest("sha1")
@@ -165,20 +165,20 @@ class TestSSLCert:
def test_err_broken_sans(self):
with open(tutils.test_data.path("mitmproxy/net/data/text_cert_weird1"), "rb") as f:
d = f.read()
- c = certs.SSLCert.from_pem(d)
+ c = certs.Cert.from_pem(d)
# This breaks unless we ignore a decoding error.
assert c.altnames is not None
def test_der(self):
with open(tutils.test_data.path("mitmproxy/net/data/dercert"), "rb") as f:
d = f.read()
- s = certs.SSLCert.from_der(d)
+ s = certs.Cert.from_der(d)
assert s.cn
def test_state(self):
with open(tutils.test_data.path("mitmproxy/net/data/text_cert"), "rb") as f:
d = f.read()
- c = certs.SSLCert.from_pem(d)
+ c = certs.Cert.from_pem(d)
c.get_state()
c2 = c.copy()
@@ -188,6 +188,6 @@ class TestSSLCert:
assert c == c2
assert c is not c2
- x = certs.SSLCert('')
+ x = certs.Cert('')
x.set_state(a)
assert x == c