diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2013-12-27 08:22:07 -0800 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2013-12-27 08:22:07 -0800 |
commit | 4b31af7407ab6221712e8d83cd1bce53bd57aa95 (patch) | |
tree | 7b6774bc8559f51b47cb3510c244146ce20d00fb /tests/test_utils.py | |
parent | 3ac297e4c9b655b3222da1830e9677c9d03a3926 (diff) | |
parent | 37c88a0dea800b3028f95bf71a8cd6e344254d4e (diff) | |
download | cryptography-4b31af7407ab6221712e8d83cd1bce53bd57aa95.tar.gz cryptography-4b31af7407ab6221712e8d83cd1bce53bd57aa95.tar.bz2 cryptography-4b31af7407ab6221712e8d83cd1bce53bd57aa95.zip |
Merge branch 'master' into fernet
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 |