def test_get_cert_expiration(self): exp_date = cert_parser.get_cert_expiration(sample_certs.X509_EXPIRED) self.assertEqual(datetime.datetime(2016, 9, 25, 18, 1, 54), exp_date) # test the exception self.assertRaises(exceptions.UnreadableCert, cert_parser.get_cert_expiration, 'bad-cert-file')
def test_get_cert_expiration(self): exp_date = cert_parser.get_cert_expiration(ALT_EXT_CRT) self.assertEqual(datetime.datetime(2025, 5, 18, 20, 33, 23), exp_date) # test the exception self.assertRaises(exceptions.UnreadableCert, cert_parser.get_cert_expiration, 'bad-cert-file')
def execute(self, amphora_id, server_pem): LOG.debug("Update DB cert expiry date of amphora id: %s", amphora_id) cert_expiration = cert_parser.get_cert_expiration(server_pem) LOG.debug("Certificate expiration date is %s ", cert_expiration) self.amphora_repo.update(db_apis.get_session(), amphora_id, cert_expiration=cert_expiration)