Example #1
0
    def test_blacklist_names_bad_cn(self):
        csr = x509_csr.X509Csr()
        name = csr.get_subject()
        name.add_name_entry(x509_name.OID_commonName, "bad.example.com")

        with self.assertRaises(errors.ValidationError):
            custom.blacklist_names(
                csr=csr,
                domains=['.example.com'],
            )
    def test_blacklist_names_bad_cn(self):
        csr = x509_csr.X509Csr()
        name = csr.get_subject()
        name.add_name_entry(x509_name.OID_commonName, "bad.example.com")

        with self.assertRaises(errors.ValidationError):
            custom.blacklist_names(
                csr=csr,
                domains=['.example.com'],
            )
    def test_blacklist_names_bad(self):
        csr = x509_csr.X509Csr()
        ext = x509_ext.X509ExtensionSubjectAltName()
        ext.add_dns_id('bad.example.com')
        csr.add_extension(ext)

        with self.assertRaises(errors.ValidationError):
            custom.blacklist_names(
                csr=csr,
                domains=['.example.com'],
            )
Example #4
0
    def test_blacklist_names_bad(self):
        csr = x509_csr.X509Csr()
        ext = x509_ext.X509ExtensionSubjectAltName()
        ext.add_dns_id('bad.example.com')
        csr.add_extension(ext)

        with self.assertRaises(errors.ValidationError):
            custom.blacklist_names(
                csr=csr,
                domains=['.example.com'],
            )
Example #5
0
    def test_blacklist_names_empty_list(self):
        # empty blacklist should pass everything through
        csr = x509_csr.X509Csr()
        ext = x509_ext.X509ExtensionSubjectAltName()
        ext.add_dns_id('good.example.com')
        csr.add_extension(ext)

        self.assertEqual(None, custom.blacklist_names(csr=csr, ))
Example #6
0
    def test_blacklist_names_good(self):
        csr = x509_csr.X509Csr()
        ext = x509_ext.X509ExtensionSubjectAltName()
        ext.add_dns_id('good.example.com')
        csr.add_extension(ext)

        self.assertEqual(
            None, custom.blacklist_names(
                csr=csr,
                domains=['.example.org'],
            ))
    def test_blacklist_names_empty_list(self):
        # empty blacklist should pass everything through
        csr = x509_csr.X509Csr()
        ext = x509_ext.X509ExtensionSubjectAltName()
        ext.add_dns_id('good.example.com')
        csr.add_extension(ext)

        self.assertEqual(
            None,
            custom.blacklist_names(
                csr=csr,
            )
        )
    def test_blacklist_names_good(self):
        csr = x509_csr.X509Csr()
        ext = x509_ext.X509ExtensionSubjectAltName()
        ext.add_dns_id('good.example.com')
        csr.add_extension(ext)

        self.assertEqual(
            None,
            custom.blacklist_names(
                csr=csr,
                domains=['.example.org'],
            )
        )