diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2015-12-26 12:05:51 -0500 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2015-12-26 12:05:51 -0500 |
commit | d67d77f666417bff7ea52e2754f7a680c7a83b0c (patch) | |
tree | 796e8feff62e053b9a73626402424e322dfe48bd /tests/test_x509_ext.py | |
parent | 0860ef60adc7974dc26cfdd3c7adeb5e4e6e6448 (diff) | |
parent | 7058eced3a27115f721887e836d16ee4fe4c7e9d (diff) | |
download | cryptography-d67d77f666417bff7ea52e2754f7a680c7a83b0c.tar.gz cryptography-d67d77f666417bff7ea52e2754f7a680c7a83b0c.tar.bz2 cryptography-d67d77f666417bff7ea52e2754f7a680c7a83b0c.zip |
Merge pull request #2579 from reaperhulk/crlentry-crlreason
switch CRLReason to use a class
Diffstat (limited to 'tests/test_x509_ext.py')
-rw-r--r-- | tests/test_x509_ext.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py index 037512a4..b8105a4b 100644 --- a/tests/test_x509_ext.py +++ b/tests/test_x509_ext.py @@ -112,6 +112,29 @@ class TestCertificateIssuer(object): assert names == [u"cryptography.io"] +class TestCRLReason(object): + def test_invalid_reason_flags(self): + with pytest.raises(TypeError): + x509.CRLReason("notareason") + + def test_eq(self): + reason1 = x509.CRLReason(x509.ReasonFlags.unspecified) + reason2 = x509.CRLReason(x509.ReasonFlags.unspecified) + assert reason1 == reason2 + + def test_ne(self): + reason1 = x509.CRLReason(x509.ReasonFlags.unspecified) + reason2 = x509.CRLReason(x509.ReasonFlags.ca_compromise) + assert reason1 != reason2 + assert reason1 != object() + + def test_repr(self): + reason1 = x509.CRLReason(x509.ReasonFlags.unspecified) + assert repr(reason1) == ( + "<CRLReason(reason=ReasonFlags.unspecified)>" + ) + + class TestNoticeReference(object): def test_notice_numbers_not_all_int(self): with pytest.raises(TypeError): |