From 108605b01873c4176275cc6bf2ea0d0b7c447a0e Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sat, 4 Jan 2014 13:37:00 -0600 Subject: add commoncrypto mark to skip on non-OS X platforms --- tests/hazmat/bindings/test_bindings.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/hazmat/bindings/test_bindings.py (limited to 'tests/hazmat/bindings/test_bindings.py') diff --git a/tests/hazmat/bindings/test_bindings.py b/tests/hazmat/bindings/test_bindings.py new file mode 100644 index 00000000..927bc8a1 --- /dev/null +++ b/tests/hazmat/bindings/test_bindings.py @@ -0,0 +1,31 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import, division, print_function + +import cffi + +from cryptography.hazmat.bindings.utils import binding_available +from cryptography.hazmat.bindings.openssl.binding import Binding + + +def dummy_initializer(): + raise cffi.VerificationError + + +def test_binding_available(): + assert binding_available(Binding._ensure_ffi_initialized) is True + + +def test_binding_unavailable(): + assert binding_available(dummy_initializer) is False -- cgit v1.2.3 From fefe3c224353e4e37b02f1df0fc9558f68f8c464 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sat, 4 Jan 2014 18:43:19 -0600 Subject: make the dummy_initializer fail with an actual verify call --- tests/hazmat/bindings/test_bindings.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/hazmat/bindings/test_bindings.py') diff --git a/tests/hazmat/bindings/test_bindings.py b/tests/hazmat/bindings/test_bindings.py index 927bc8a1..5b13d543 100644 --- a/tests/hazmat/bindings/test_bindings.py +++ b/tests/hazmat/bindings/test_bindings.py @@ -20,7 +20,8 @@ from cryptography.hazmat.bindings.openssl.binding import Binding def dummy_initializer(): - raise cffi.VerificationError + ffi = cffi.FFI() + ffi.verify(source="include ") def test_binding_available(): -- cgit v1.2.3 From 02ed961c963f0d27fe23e9608223ccc8dd3be7f6 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sat, 4 Jan 2014 19:36:39 -0600 Subject: missing # --- tests/hazmat/bindings/test_bindings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/hazmat/bindings/test_bindings.py') diff --git a/tests/hazmat/bindings/test_bindings.py b/tests/hazmat/bindings/test_bindings.py index 5b13d543..7af1d581 100644 --- a/tests/hazmat/bindings/test_bindings.py +++ b/tests/hazmat/bindings/test_bindings.py @@ -21,7 +21,7 @@ from cryptography.hazmat.bindings.openssl.binding import Binding def dummy_initializer(): ffi = cffi.FFI() - ffi.verify(source="include ") + ffi.verify(source="#include ") def test_binding_available(): -- cgit v1.2.3