From a33a5e3e17140f8877aafa9db55f69008d4f42d2 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sun, 19 Jan 2014 22:27:00 -0600 Subject: add error handler --- tests/hazmat/backends/test_commoncrypto.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/hazmat/backends') diff --git a/tests/hazmat/backends/test_commoncrypto.py b/tests/hazmat/backends/test_commoncrypto.py index 1d768ec4..8b353237 100644 --- a/tests/hazmat/backends/test_commoncrypto.py +++ b/tests/hazmat/backends/test_commoncrypto.py @@ -29,3 +29,15 @@ class TestCommonCrypto(object): from cryptography.hazmat.backends.commoncrypto.backend import backend with pytest.raises(ValueError): backend.register_cipher_adapter(AES, CBC, None) + + def test_handle_response(self): + from cryptography.hazmat.backends.commoncrypto.backend import backend + + with pytest.raises(ValueError): + backend._check_response(backend._lib.kCCAlignmentError) + + with pytest.raises(SystemError): + backend._check_response(backend._lib.kCCMemoryFailure) + + with pytest.raises(SystemError): + backend._check_response(backend._lib.kCCDecodeError) -- cgit v1.2.3