diff options
author | Jean-Paul Calderone <exarkun@twistedmatrix.com> | 2013-12-27 11:09:42 -0500 |
---|---|---|
committer | Jean-Paul Calderone <exarkun@twistedmatrix.com> | 2013-12-27 11:09:42 -0500 |
commit | 08adc00087c8fe128abc2317776de1f974f4eed6 (patch) | |
tree | 9baacf858eb2ab752505cec675ddda118ed2f35d /tests/test_utils.py | |
parent | cf99cc77f863a7254d449ecb5f80a35ad7db11ab (diff) | |
parent | b645521e84026633f666aa107816ac2fc5e05cc6 (diff) | |
download | cryptography-08adc00087c8fe128abc2317776de1f974f4eed6.tar.gz cryptography-08adc00087c8fe128abc2317776de1f974f4eed6.tar.bz2 cryptography-08adc00087c8fe128abc2317776de1f974f4eed6.zip |
Merge remote-tracking branch 'origin/master' into some-typedef-fixes
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 |