def test_only_wanted_returns_from_selector(self): SELECTED = (('ST', 'Östergötland'), ('L', 'Norrköping'), ('OU', 'Muppar Teknik')) SELECTOR = (b'ST', b'L', b'OU') result = get_ca_prefix(fixtures.CertificateData.ca_cert.pem, SELECTOR) self.assertEqual(SELECTED, result)
def test_valid_returns_from_default_subject(self): r = get_ca_prefix(fixtures.CertificateData.ca_cert.pem) self.assertEqual(fixtures.CertificateData.ca_cert.common_subject, r)
def test_empty_returns_from_empty_selector(self): result = get_ca_prefix(fixtures.CertificateData.ca_cert.pem, ()) self.assertEqual((), result)
def test_empty_returns_from_empty_subject(self): result = get_ca_prefix(fixtures.CertificateData.initial.pem) self.assertEqual((), result)
def test_outdated_cert_should_work(self): get_ca_prefix(fixtures.CertificateData.expired.pem)
def test_valid_cert(self): get_ca_prefix(fixtures.CertificateData.ca_cert.pem)
def test_blank_file(self): import OpenSSL with self.assertRaises(OpenSSL.crypto.Error): get_ca_prefix("")
def test_only_CN_returns_from_CN_selector(self): CN_TUPLE = (('CN', 'Caramel Signing Certificate'),) result = get_ca_prefix(fixtures.CertificateData.ca_cert.pem, (b'CN', )) self.assertEqual(CN_TUPLE, result)