From 82499edbd6b82ee4b9e8b5adfc9979f18c5d1975 Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Sat, 17 Oct 2015 14:16:24 -0700 Subject: [PATCH] Added tests to crypto_util --- letsencrypt/tests/crypto_util_test.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/letsencrypt/tests/crypto_util_test.py b/letsencrypt/tests/crypto_util_test.py index 2e04c748a..f0b8c0e4d 100644 --- a/letsencrypt/tests/crypto_util_test.py +++ b/letsencrypt/tests/crypto_util_test.py @@ -15,6 +15,7 @@ from letsencrypt.tests import test_util RSA256_KEY = test_util.load_vector('rsa256_key.pem') RSA512_KEY = test_util.load_vector('rsa512_key.pem') +CERT_PATH = test_util.vector_path('cert.pem') CERT = test_util.load_vector('cert.pem') SAN_CERT = test_util.load_vector('cert-san.pem') @@ -232,5 +233,23 @@ class CertLoaderTest(unittest.TestCase): pyopenssl_load_certificate(bad_cert_data) +class NotBeforeTest(unittest.TestCase): + """Tests for letsencrypt.crypto_util.notBefore""" + + def test_notBefore(self): + from letsencrypt.crypto_util import notBefore + self.assertEqual(notBefore(CERT_PATH).isoformat(), + '2014-12-11T22:34:45+00:00') + + +class NotAfterTest(unittest.TestCase): + """Tests for letsencrypt.crypto_util.notAfter""" + + def test_notAfter(self): + from letsencrypt.crypto_util import notAfter + self.assertEqual(notAfter(CERT_PATH).isoformat(), + '2014-12-18T22:34:45+00:00') + + if __name__ == '__main__': unittest.main() # pragma: no cover