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

Method test_parse_cert_CVE_2013_4238

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

Source from the content-addressed store, hash-verified

450 )
451
452 def test_parse_cert_CVE_2013_4238(self):
453 p = ssl._ssl._test_decode_cert(NULLBYTECERT)
454 if support.verbose:
455 sys.stdout.write("\n" + pprint.pformat(p) + "\n")
456 subject = ((('countryName', 'US'),),
457 (('stateOrProvinceName', 'Oregon'),),
458 (('localityName', 'Beaverton'),),
459 (('organizationName', 'Python Software Foundation'),),
460 (('organizationalUnitName', 'Python Core Development'),),
461 (('commonName', 'null.python.org\x00example.org'),),
462 (('emailAddress', 'python-dev@python.org'),))
463 self.assertEqual(p['subject'], subject)
464 self.assertEqual(p['issuer'], subject)
465 if ssl._OPENSSL_API_VERSION >= (0, 9, 8):
466 san = (('DNS', 'altnull.python.org\x00example.com'),
467 ('email', 'null@python.org\x00user@example.org'),
468 ('URI', 'http://null.python.org\x00http://example.org'),
469 ('IP Address', '192.0.2.1'),
470 ('IP Address', '2001:DB8:0:0:0:0:0:1'))
471 else:
472 # OpenSSL 0.9.7 doesn't support IPv6 addresses in subjectAltName
473 san = (('DNS', 'altnull.python.org\x00example.com'),
474 ('email', 'null@python.org\x00user@example.org'),
475 ('URI', 'http://null.python.org\x00http://example.org'),
476 ('IP Address', '192.0.2.1'),
477 ('IP Address', '<invalid>'))
478
479 self.assertEqual(p['subjectAltName'], san)
480
481 def test_parse_all_sans(self):
482 p = ssl._ssl._test_decode_cert(ALLSANFILE)

Callers

nothing calls this directly

Calls 3

pformatMethod · 0.80
writeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected