File: test_util.py

package info (click to toggle)
pyopenssl 16.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,116 kB
  • ctags: 1,575
  • sloc: python: 7,405; makefile: 146
file content (19 lines) | stat: -rw-r--r-- 646 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from OpenSSL._util import exception_from_error_queue, lib

from .util import TestCase


class ErrorTests(TestCase):
    """
    Tests for handling of certain OpenSSL error cases.
    """
    def test_exception_from_error_queue_nonexistent_reason(self):
        """
        :py:func:`exception_from_error_queue` raises ``ValueError`` when it
        encounters an OpenSSL error code which does not have a reason string.
        """
        lib.ERR_put_error(lib.ERR_LIB_EVP, 0, 1112, b"", 10)
        exc = self.assertRaises(
            ValueError, exception_from_error_queue, ValueError
        )
        self.assertEqual(exc.args[0][0][2], "")