aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-01-11 20:04:37 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-01-11 20:04:37 -0600
commit23d569e1eb03c44688f91377223e97df53291c13 (patch)
tree36686e8cd298b0e883a72562f6d4715bf102d8ed /tests
parentb53e5a05f199b48de9f2f52afd29be4b9c876595 (diff)
parentfa4700006ea1eb45387f2f4f0493ad07f78d1ad9 (diff)
downloadcryptography-23d569e1eb03c44688f91377223e97df53291c13.tar.gz
cryptography-23d569e1eb03c44688f91377223e97df53291c13.tar.bz2
cryptography-23d569e1eb03c44688f91377223e97df53291c13.zip
Merge branch 'master' into common-crypto-backend
* master: Use pytest.fixture for backends drop to >= 0.8 to make pypy happy change to anonymous enum require cffi >= 0.8.1 remove extraneous spaces add hmac to commoncrypto binding bytes byte back add check to confirm we've loaded error strings Bind all the PEM errors Spelling! oops, bytes plz don't leak a context in the test add tests to the openssl backend to verify that we've registered Nonsense I think we need. This is a dep init the ssl library in the backend Actuall install a thing Try to run the spellchecker on travis Use a normal quote here, not sure where the smart quote came from Expose ERR_load_SSL_strings
Diffstat (limited to 'tests')
-rw-r--r--tests/conftest.py9
-rw-r--r--tests/hazmat/backends/test_openssl.py18
2 files changed, 22 insertions, 5 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 0ddc3338..1d9f96ed 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,5 +1,6 @@
import pytest
+from cryptography.hazmat.backends import _ALL_BACKENDS
from cryptography.hazmat.backends.interfaces import (
HMACBackend, CipherBackend, HashBackend
)
@@ -7,11 +8,9 @@ from cryptography.hazmat.backends.interfaces import (
from .utils import check_for_iface, check_backend_support
-def pytest_generate_tests(metafunc):
- from cryptography.hazmat.backends import _ALL_BACKENDS
-
- if "backend" in metafunc.fixturenames:
- metafunc.parametrize("backend", _ALL_BACKENDS)
+@pytest.fixture(params=_ALL_BACKENDS)
+def backend(request):
+ return request.param
@pytest.mark.trylast
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py
index ad399594..2a329920 100644
--- a/tests/hazmat/backends/test_openssl.py
+++ b/tests/hazmat/backends/test_openssl.py
@@ -95,3 +95,21 @@ class TestOpenSSL(object):
backend._lib.EVP_F_EVP_DECRYPTFINAL_EX,
0
)
+
+ def test_ssl_ciphers_registered(self):
+ meth = backend._lib.TLSv1_method()
+ ctx = backend._lib.SSL_CTX_new(meth)
+ assert ctx != backend._ffi.NULL
+ backend._lib.SSL_CTX_free(ctx)
+
+ def test_evp_ciphers_registered(self):
+ cipher = backend._lib.EVP_get_cipherbyname(b"aes-256-cbc")
+ assert cipher != backend._ffi.NULL
+
+ def test_error_strings_loaded(self):
+ # returns a value in a static buffer
+ err = backend._lib.ERR_error_string(101183626, backend._ffi.NULL)
+ assert backend._ffi.string(err) == (
+ b"error:0607F08A:digital envelope routines:EVP_EncryptFinal_ex:"
+ b"data not multiple of block length"
+ )