def test_alternative_names_bad_domain(self): csr = x509_csr.X509Csr() ext = x509_ext.X509ExtensionSubjectAltName() ext.add_dns_id('bad.example.org') csr.add_extension(ext) with self.assertRaises(errors.ValidationError) as e: custom.alternative_names(csr=csr, allowed_domains=['.example.com']) self.assertEqual( "Domain 'bad.example.org' not allowed (doesn't " "match known domains)", str(e.exception))
def test_alternative_names_bad_domain(self): csr = x509_csr.X509Csr() ext = x509_ext.X509ExtensionSubjectAltName() ext.add_dns_id('bad.example.org') csr.add_extension(ext) with self.assertRaises(errors.ValidationError) as e: custom.alternative_names( csr=csr, allowed_domains=['.example.com']) self.assertEqual("Domain 'bad.example.org' not allowed (doesn't " "match known domains)", str(e.exception))
def test_alternative_names_good_domain(self): csr = x509_csr.X509Csr() ext = x509_ext.X509ExtensionSubjectAltName() ext.add_dns_id('good.example.com') csr.add_extension(ext) self.assertEqual( None, custom.alternative_names( csr=csr, allowed_domains=['.example.com'], ))
def test_alternative_names_good_domain(self): csr = x509_csr.X509Csr() ext = x509_ext.X509ExtensionSubjectAltName() ext.add_dns_id('good.example.com') csr.add_extension(ext) self.assertEqual( None, custom.alternative_names( csr=csr, allowed_domains=['.example.com'], ) )