aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/backends
diff options
context:
space:
mode:
authorAlex Stapleton <alexs@prol.etari.at>2014-03-01 20:54:13 +0000
committerAlex Stapleton <alexs@prol.etari.at>2014-03-01 20:54:13 +0000
commit235d3ce2b7ae13cf94c97c00f5aa89c40bc6763c (patch)
tree70243f6a1e864791f1f93b07fe4c29c343a67bb5 /tests/hazmat/backends
parente5dadb2d3c6c0e7062dc73f8a50aa6f7b457b64f (diff)
downloadcryptography-235d3ce2b7ae13cf94c97c00f5aa89c40bc6763c.tar.gz
cryptography-235d3ce2b7ae13cf94c97c00f5aa89c40bc6763c.tar.bz2
cryptography-235d3ce2b7ae13cf94c97c00f5aa89c40bc6763c.zip
Get rid of handle_errors
Diffstat (limited to 'tests/hazmat/backends')
-rw-r--r--tests/hazmat/backends/test_openssl.py39
1 files changed, 5 insertions, 34 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py
index b24808df..fb9b978d 100644
--- a/tests/hazmat/backends/test_openssl.py
+++ b/tests/hazmat/backends/test_openssl.py
@@ -71,46 +71,17 @@ class TestOpenSSL(object):
with pytest.raises(UnsupportedAlgorithm):
cipher.encryptor()
- def test_handle_unknown_error(self):
- with pytest.raises(InternalError):
- backend._handle_error_code(0)
-
- backend._lib.ERR_put_error(backend._lib.ERR_LIB_EVP, 0, 0,
- b"test_openssl.py", -1)
- with pytest.raises(InternalError):
- backend._handle_error(None)
-
- backend._lib.ERR_put_error(
- backend._lib.ERR_LIB_EVP,
- backend._lib.EVP_F_EVP_ENCRYPTFINAL_EX,
- 0,
- b"test_openssl.py",
- -1
- )
- with pytest.raises(InternalError):
- backend._handle_error(None)
-
- backend._lib.ERR_put_error(
- backend._lib.ERR_LIB_EVP,
- backend._lib.EVP_F_EVP_DECRYPTFINAL_EX,
- 0,
- b"test_openssl.py",
- -1
- )
- with pytest.raises(InternalError):
- backend._handle_error(None)
-
- def test_handle_multiple_errors(self):
+ def test_consume_errors(self):
for i in range(10):
backend._lib.ERR_put_error(backend._lib.ERR_LIB_EVP, 0, 0,
b"test_openssl.py", -1)
assert backend._lib.ERR_peek_error() != 0
- with pytest.raises(InternalError):
- backend._handle_error(None)
+ errors = backend._consume_errors()
assert backend._lib.ERR_peek_error() == 0
+ assert len(errors) == 10
def test_openssl_error_string(self):
backend._lib.ERR_put_error(
@@ -121,8 +92,8 @@ class TestOpenSSL(object):
-1
)
- with pytest.raises(InternalError) as exc:
- backend._handle_error(None)
+ errors = backend._consume_errors()
+ exc = backend._unknown_error(errors[0])
assert (
"digital envelope routines:"