Alex Gaynor | de1906a | 2014-08-12 16:12:54 -0700 | [diff] [blame] | 1 | from OpenSSL._util import exception_from_error_queue, lib |
| 2 | from OpenSSL.test.util import TestCase |
| 3 | |
| 4 | |
| 5 | |
| 6 | class TestErrors(TestCase): |
| 7 | def test_exception_from_error_queue_nonexistant_reason(self): |
Alex Gaynor | 9823239 | 2014-08-15 11:23:00 -0700 | [diff] [blame^] | 8 | """ |
| 9 | :py:func:`exception_from_error_queue` does not raise a ``TypeError`` |
| 10 | when it encounters an OpenSSL error code which does not have a reason |
| 11 | string. |
| 12 | """ |
Alex Gaynor | bae2dc3 | 2014-08-14 13:44:54 -0700 | [diff] [blame] | 13 | lib.ERR_put_error(lib.ERR_LIB_EVP, 0, 1112, b"", 10) |
Alex Gaynor | de1906a | 2014-08-12 16:12:54 -0700 | [diff] [blame] | 14 | exc = self.assertRaises(ValueError, exception_from_error_queue, ValueError) |
| 15 | self.assertEqual(exc.args[0][0][2], "") |