diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-12-25 22:35:19 -0600 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-12-26 11:19:02 -0600 |
commit | 23c0bbc2dc007aa507b22f407c3a0048be98a1a4 (patch) | |
tree | 42370a4977fa7365d2e3d1aa9a9ffeaf71afbc9c /tests/test_x509_ext.py | |
parent | d67d77f666417bff7ea52e2754f7a680c7a83b0c (diff) | |
download | cryptography-23c0bbc2dc007aa507b22f407c3a0048be98a1a4.tar.gz cryptography-23c0bbc2dc007aa507b22f407c3a0048be98a1a4.tar.bz2 cryptography-23c0bbc2dc007aa507b22f407c3a0048be98a1a4.zip |
add invaliditydate class for crl entry extensions
Diffstat (limited to 'tests/test_x509_ext.py')
-rw-r--r-- | tests/test_x509_ext.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py index b8105a4b..91a07654 100644 --- a/tests/test_x509_ext.py +++ b/tests/test_x509_ext.py @@ -5,6 +5,7 @@ from __future__ import absolute_import, division, print_function import binascii +import datetime import ipaddress import os @@ -135,6 +136,29 @@ class TestCRLReason(object): ) +class TestInvalidityDate(object): + def test_invalid_invalidity_date(self): + with pytest.raises(TypeError): + x509.InvalidityDate("notadate") + + def test_eq(self): + invalid1 = x509.InvalidityDate(datetime.datetime(2015, 1, 1, 1, 1)) + invalid2 = x509.InvalidityDate(datetime.datetime(2015, 1, 1, 1, 1)) + assert invalid1 == invalid2 + + def test_ne(self): + invalid1 = x509.InvalidityDate(datetime.datetime(2015, 1, 1, 1, 1)) + invalid2 = x509.InvalidityDate(datetime.datetime(2015, 1, 1, 1, 2)) + assert invalid1 != invalid2 + assert invalid1 != object() + + def test_repr(self): + invalid1 = x509.InvalidityDate(datetime.datetime(2015, 1, 1, 1, 1)) + assert repr(invalid1) == ( + "<InvalidityDate(invalidity_date=2015-01-01 01:01:00)>" + ) + + class TestNoticeReference(object): def test_notice_numbers_not_all_int(self): with pytest.raises(TypeError): |