예제 #1
0
 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)
예제 #2
0
 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)
예제 #3
0
 def test_empty_returns_from_empty_selector(self):
     result = get_ca_prefix(fixtures.CertificateData.ca_cert.pem, ())
     self.assertEqual((), result)
예제 #4
0
 def test_empty_returns_from_empty_subject(self):
     result = get_ca_prefix(fixtures.CertificateData.initial.pem)
     self.assertEqual((), result)
예제 #5
0
 def test_outdated_cert_should_work(self):
     get_ca_prefix(fixtures.CertificateData.expired.pem)
예제 #6
0
 def test_valid_cert(self):
     get_ca_prefix(fixtures.CertificateData.ca_cert.pem)
예제 #7
0
 def test_blank_file(self):
     import OpenSSL
     with self.assertRaises(OpenSSL.crypto.Error):
         get_ca_prefix("")
예제 #8
0
 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)