MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / test_chain_file

Method test_chain_file

test/mitmproxy/test_certs.py:69–79  ·  view source on GitHub ↗
(self, tdata, tmp_path)

Source from the content-addressed store, hash-verified

67 assert tstore.get_cert(None, []).cert.cn is None
68
69 def test_chain_file(self, tdata, tmp_path):
70 cert = Path(tdata.path("mitmproxy/data/confdir/mitmproxy-ca.pem")).read_bytes()
71 (tmp_path / "mitmproxy-ca.pem").write_bytes(cert)
72 ca = certs.CertStore.from_store(tmp_path, "mitmproxy", 2048)
73 assert ca.default_chain_file is None
74 assert len(ca.default_chain_certs) == 1
75
76 (tmp_path / "mitmproxy-ca.pem").write_bytes(2 * cert)
77 ca = certs.CertStore.from_store(tmp_path, "mitmproxy", 2048)
78 assert ca.default_chain_file == (tmp_path / "mitmproxy-ca.pem")
79 assert len(ca.default_chain_certs) == 2
80
81 def test_sans(self, tstore):
82 c1 = tstore.get_cert("foo.com", [x509.DNSName("*.bar.com")])

Callers

nothing calls this directly

Calls 3

PathClass · 0.85
from_storeMethod · 0.80
pathMethod · 0.45

Tested by

no test coverage detected