MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_get_ca_certs

Method test_get_ca_certs

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

Source from the content-addressed store, hash-verified

1438 {'x509_ca': 1, 'crl': 0, 'x509': 2})
1439
1440 def test_get_ca_certs(self):
1441 ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
1442 self.assertEqual(ctx.get_ca_certs(), [])
1443 # CERTFILE is not flagged as X509v3 Basic Constraints: CA:TRUE
1444 ctx.load_verify_locations(CERTFILE)
1445 self.assertEqual(ctx.get_ca_certs(), [])
1446 # but CAFILE_CACERT is a CA cert
1447 ctx.load_verify_locations(CAFILE_CACERT)
1448 self.assertEqual(ctx.get_ca_certs(),
1449 [{'issuer': ((('organizationName', 'Root CA'),),
1450 (('organizationalUnitName', 'http://www.cacert.org'),),
1451 (('commonName', 'CA Cert Signing Authority'),),
1452 (('emailAddress', 'support@cacert.org'),)),
1453 'notAfter': 'Mar 29 12:29:49 2033 GMT',
1454 'notBefore': 'Mar 30 12:29:49 2003 GMT',
1455 'serialNumber': '00',
1456 'crlDistributionPoints': ('https://www.cacert.org/revoke.crl',),
1457 'subject': ((('organizationName', 'Root CA'),),
1458 (('organizationalUnitName', 'http://www.cacert.org'),),
1459 (('commonName', 'CA Cert Signing Authority'),),
1460 (('emailAddress', 'support@cacert.org'),)),
1461 'version': 3}])
1462
1463 with open(CAFILE_CACERT) as f:
1464 pem = f.read()
1465 der = ssl.PEM_cert_to_DER_cert(pem)
1466 self.assertEqual(ctx.get_ca_certs(True), [der])
1467
1468 def test_load_default_certs(self):
1469 ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)

Callers

nothing calls this directly

Calls 5

openFunction · 0.50
assertEqualMethod · 0.45
get_ca_certsMethod · 0.45
load_verify_locationsMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected