diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2016-03-11 11:17:26 -0400 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2016-03-11 11:17:26 -0400 |
commit | 2c605ba25ec9f0288ce94a424688a9b6c99b584f (patch) | |
tree | fc55d84ebbfb5c930ebe6a14053a9d99ef2e6475 | |
parent | 5aad73cf4b612dc93869387cc82e97e3d0ca83a7 (diff) | |
download | pyopenssl-2c605ba25ec9f0288ce94a424688a9b6c99b584f.tar.gz |
move to separate pytest class + add one more test case
-rw-r--r-- | tests/test_crypto.py | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/tests/test_crypto.py b/tests/test_crypto.py index d5cecad..136af0a 100644 --- a/tests/test_crypto.py +++ b/tests/test_crypto.py @@ -2972,9 +2972,34 @@ class NetscapeSPKITests(TestCase, _PKeyInteractionTestsMixin): self.assertTrue(isinstance(blob, binary_type)) +class TestRevoked(object): + """ + Please add test cases for the Revoked class here if possible. This class + holds the new py.test style tests. + """ + def test_ignores_unsupported_revoked_cert_extension_get_reason(self): + """ + The get_reason method on the Revoked class checks to see if the + extension is NID_crl_reason and should skip it otherwise. This test + loads a CRL with extensions it should ignore. + """ + crl = load_crl(FILETYPE_PEM, crlDataUnsupportedExtension) + revoked = crl.get_revoked() + reason = revoked[1].get_reason() + assert reason == b'Unspecified' + + def test_ignores_unsupported_revoked_cert_extension_set_new_reason(self): + crl = load_crl(FILETYPE_PEM, crlDataUnsupportedExtension) + revoked = crl.get_revoked() + revoked[1].set_reason(None) + reason = revoked[1].get_reason() + assert reason is None + + class RevokedTests(TestCase): """ - Tests for :py:obj:`OpenSSL.crypto.Revoked` + Tests for :py:obj:`OpenSSL.crypto.Revoked`. Please add test cases to + TestRevoked above if possible. """ def test_construction(self): @@ -3036,17 +3061,6 @@ class RevokedTests(TestCase): date = revoked.get_rev_date() self.assertEqual(date, now) - def test_ignores_unsupported_revoked_cert_extension(self): - """ - The get_reason method on the Revoked class checks to see if the - extension is NID_crl_reason and should skip it otherwise. This test - loads a CRL with extensions it should ignore. - """ - crl = load_crl(FILETYPE_PEM, crlDataUnsupportedExtension) - revoked = crl.get_revoked() - reason = revoked[1].get_reason() - assert reason == b'Unspecified' - def test_reason(self): """ Confirm we can set and get revocation reasons from |