MCPcopy Index your code
hub / github.com/python/cpython / test_get_ca_certs

Method test_get_ca_certs

Lib/test/test_ssl.py:1623–1649  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1621 {'x509_ca': 1, 'crl': 0, 'x509': 2})
1622
1623 def test_get_ca_certs(self):
1624 ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
1625 self.assertEqual(ctx.get_ca_certs(), [])
1626 # CERTFILE is not flagged as X509v3 Basic Constraints: CA:TRUE
1627 ctx.load_verify_locations(CERTFILE)
1628 self.assertEqual(ctx.get_ca_certs(), [])
1629 # but CAFILE_CACERT is a CA cert
1630 ctx.load_verify_locations(CAFILE_CACERT)
1631 self.assertEqual(ctx.get_ca_certs(),
1632 [{'issuer': ((('organizationName', 'Root CA'),),
1633 (('organizationalUnitName', 'http://www.cacert.org'),),
1634 (('commonName', 'CA Cert Signing Authority'),),
1635 (('emailAddress', 'support@cacert.org'),)),
1636 'notAfter': 'Mar 29 12:29:49 2033 GMT',
1637 'notBefore': 'Mar 30 12:29:49 2003 GMT',
1638 'serialNumber': '00',
1639 'crlDistributionPoints': ('https://www.cacert.org/revoke.crl',),
1640 'subject': ((('organizationName', 'Root CA'),),
1641 (('organizationalUnitName', 'http://www.cacert.org'),),
1642 (('commonName', 'CA Cert Signing Authority'),),
1643 (('emailAddress', 'support@cacert.org'),)),
1644 'version': 3}])
1645
1646 with open(CAFILE_CACERT) as f:
1647 pem = f.read()
1648 der = ssl.PEM_cert_to_DER_cert(pem)
1649 self.assertEqual(ctx.get_ca_certs(True), [der])
1650
1651 def test_load_default_certs(self):
1652 ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)

Callers

nothing calls this directly

Calls 3

openFunction · 0.50
assertEqualMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected