Beispiel #1
0
 def test_uid_invalid_certificate(self, fake_read, fake_valid):
     fake_read.return_value = CERTIFICATE
     fake_valid.return_value = False
     bundle = Bundle('')
     uid = bundle.uid()
     fake_valid.assert_called_with()
     self.assertTrue(uid is None)
Beispiel #2
0
 def test_uid_invalid_certificate(self, fake_read, fake_valid):
     fake_read.return_value = CERTIFICATE
     fake_valid.return_value = False
     bundle = Bundle('')
     uid = bundle.uid()
     fake_valid.assert_called_with()
     self.assertTrue(uid is None)
Beispiel #3
0
 def test_uid(self, fake_read, fake_valid):
     fake_read.return_value = VERIZON_CERTIFICATE
     fake_valid.return_value = True
     bundle = Bundle('')
     uid = bundle.uid()
     fake_valid.assert_called_with()
     fake_read.assert_called_with()
     self.assertEqual(uid, 'vzn-user')
Beispiel #4
0
 def test_uid(self, fake_read, fake_valid):
     fake_read.return_value = VERIZON_CERTIFICATE
     fake_valid.return_value = True
     bundle = Bundle('')
     uid = bundle.uid()
     fake_valid.assert_called_with()
     fake_read.assert_called_with()
     self.assertEqual(uid, 'vzn-user')
Beispiel #5
0
 def uid(self):
     """
     Get the userid (UID) part of the certificate subject.
     Returns None, if the certificate is invalid.
     :return The userid (UID) part of the certificate subject or None when
         the certificate is not found or invalid.
     :rtype: str
     """
     try:
         return Bundle.uid(self)
     except X509Error:
         log.warn('certificate: %s, not valid', self.path)