diff options
author | Julian Krause <julian.krause@gmail.com> | 2013-12-25 12:58:40 -0800 |
---|---|---|
committer | Julian Krause <julian.krause@gmail.com> | 2013-12-25 12:58:40 -0800 |
commit | e62760af74ebb8b08d7670dfaff177cdeb679f0f (patch) | |
tree | 70e51d6aadff7d1ec204793b12de221610204254 /tests/test_utils.py | |
parent | c91fe6a21fbae3107de7b2e53b7343cd67ac8c6d (diff) | |
parent | 0865a8b81075bfe073aba56e03cc57c30bfffe00 (diff) | |
download | cryptography-e62760af74ebb8b08d7670dfaff177cdeb679f0f.tar.gz cryptography-e62760af74ebb8b08d7670dfaff177cdeb679f0f.tar.bz2 cryptography-e62760af74ebb8b08d7670dfaff177cdeb679f0f.zip |
Merge branch 'master' of https://github.com/pyca/cryptography into verify
Conflicts:
tests/hazmat/primitives/test_hashes.py
tests/hazmat/primitives/test_hmac.py
Diffstat (limited to 'tests/test_utils.py')
-rw-r--r-- | tests/test_utils.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py index 5c58fd76..a65091ff 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -14,14 +14,33 @@ import os import textwrap +import pretend + import pytest from .utils import ( load_nist_vectors, load_vectors_from_file, load_cryptrec_vectors, - load_openssl_vectors, load_hash_vectors, + load_openssl_vectors, load_hash_vectors, check_for_iface ) +class FakeInterface(object): + pass + + +def test_check_for_iface(): + item = pretend.stub(keywords=["fake_name"], funcargs={"backend": True}) + with pytest.raises(pytest.skip.Exception) as exc_info: + check_for_iface("fake_name", FakeInterface, item) + assert exc_info.value.args[0] == "True backend does not support fake_name" + + item = pretend.stub( + keywords=["fake_name"], + funcargs={"backend": FakeInterface()} + ) + check_for_iface("fake_name", FakeInterface, item) + + def test_load_nist_vectors(): vector_data = textwrap.dedent(""" # CAVS 11.1 |