def test_alt_subject_name_parses(self): hosts = cert_parser.get_host_names(sample_certs.ALT_EXT_CRT) self.assertIn('www.cnfromsubject.org', hosts['cn']) self.assertIn('www.hostFromDNSName1.com', hosts['dns_names']) self.assertIn('www.hostFromDNSName2.com', hosts['dns_names']) self.assertIn('www.hostFromDNSName3.com', hosts['dns_names']) self.assertIn('www.hostFromDNSName4.com', hosts['dns_names'])
def test_alt_subject_name_parses(self): hosts = cert_parser.get_host_names(ALT_EXT_CRT) self.assertIn('www.cnfromsubject.org', hosts['cn']) self.assertIn('www.hostfromdnsname1.com', hosts['dns_names']) self.assertIn('www.hostfromdnsname2.com', hosts['dns_names']) self.assertIn('www.hostfromdnsname3.com', hosts['dns_names']) self.assertIn('www.hostfromdnsname4.com', hosts['dns_names'])
def _get_primary_cn(self, tls_cert): """Returns primary CN for Certificate.""" return cert_parser.get_host_names(tls_cert.get_certificate())['cn']