aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/bindings
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-11-14 14:34:16 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2014-11-14 14:34:16 -0800
commit5ee8ce0e4d4480a0c6b9823f9909cd1c17b53ec7 (patch)
tree8226cf7d723b126ae1c0874eff6c45265044944d /tests/hazmat/bindings
parentaf3d95fdf57e42a1bacb4cd66b58b5b5701d094c (diff)
parentc4bbc8b84eadaef703af642c1c7ba13e21ec8086 (diff)
downloadcryptography-5ee8ce0e4d4480a0c6b9823f9909cd1c17b53ec7.tar.gz
cryptography-5ee8ce0e4d4480a0c6b9823f9909cd1c17b53ec7.tar.bz2
cryptography-5ee8ce0e4d4480a0c6b9823f9909cd1c17b53ec7.zip
Merge pull request #1474 from dstufft/disable-implicit-compile
Monkeypatch the CFFI Verifier to prevent the implicit compile
Diffstat (limited to 'tests/hazmat/bindings')
-rw-r--r--tests/hazmat/bindings/test_utils.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/hazmat/bindings/test_utils.py b/tests/hazmat/bindings/test_utils.py
index 3596cd1d..5d5c4af5 100644
--- a/tests/hazmat/bindings/test_utils.py
+++ b/tests/hazmat/bindings/test_utils.py
@@ -13,6 +13,11 @@
from __future__ import absolute_import, division, print_function
+import binascii
+import os
+
+import pytest
+
from cryptography.hazmat.bindings import utils
@@ -23,3 +28,12 @@ def test_create_modulename():
assert name == "_Cryptography_cffi_bcba7f4bx4a14b588"
name = utils._create_modulename(cdef_source, source, "3.2")
assert name == "_Cryptography_cffi_a7462526x4a14b588"
+
+
+def test_implicit_compile_explodes():
+ # This uses a random comment to make sure each test gets its own hash
+ random_comment = binascii.hexlify(os.urandom(24))
+ ffi = utils.build_ffi("/* %s */" % random_comment, "")
+
+ with pytest.raises(RuntimeError):
+ ffi.verifier.load_library()