diff options
author | Hynek Schlawack <hs@ox.cx> | 2015-10-16 20:18:38 +0200 |
---|---|---|
committer | Hynek Schlawack <hs@ox.cx> | 2015-10-17 11:27:56 +0200 |
commit | f0e6685b0880bbc30099c998454925ee8d39b14e (patch) | |
tree | ef387dada69f8fe9830fa1c9d9d289760fbbe5c1 /tests/test_util.py | |
parent | 510a04eb7cb97fda2062c0c8b51724db2edbd855 (diff) | |
download | pyopenssl-git-f0e6685b0880bbc30099c998454925ee8d39b14e.tar.gz |
Move package into src
Prevents accidental imports when running tests.
Diffstat (limited to 'tests/test_util.py')
-rw-r--r-- | tests/test_util.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_util.py b/tests/test_util.py new file mode 100644 index 0000000..2aaded2 --- /dev/null +++ b/tests/test_util.py @@ -0,0 +1,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], "") |