blob: 6bc9a06b701b96079172dc16ba82520b2545d6e7 [file] [log] [blame]
Alex Gaynorde1906a2014-08-12 16:12:54 -07001from OpenSSL._util import exception_from_error_queue, lib
2from OpenSSL.test.util import TestCase
3
4
5
6class TestErrors(TestCase):
7 def test_exception_from_error_queue_nonexistant_reason(self):
Alex Gaynor98232392014-08-15 11:23:00 -07008 """
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 Gaynorbae2dc32014-08-14 13:44:54 -070013 lib.ERR_put_error(lib.ERR_LIB_EVP, 0, 1112, b"", 10)
Alex Gaynorde1906a2014-08-12 16:12:54 -070014 exc = self.assertRaises(ValueError, exception_from_error_queue, ValueError)
15 self.assertEqual(exc.args[0][0][2], "")