diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-03-15 10:37:59 -0430 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-03-15 10:37:59 -0430 |
commit | 53faebcfdd7154d1f481ef7e0cc62a1a0c1a8334 (patch) | |
tree | eb71a2f274bd80b0208e1cfdff03b57671f72561 /tests/hazmat/primitives/twofactor/test_hotp.py | |
parent | b8a9c9e6243716b353b0786dae1e6e7d94f474a8 (diff) | |
parent | a8d6b047b59794037a7be8fbfce60eedbedc100d (diff) | |
download | cryptography-53faebcfdd7154d1f481ef7e0cc62a1a0c1a8334.tar.gz cryptography-53faebcfdd7154d1f481ef7e0cc62a1a0c1a8334.tar.bz2 cryptography-53faebcfdd7154d1f481ef7e0cc62a1a0c1a8334.zip |
Merge pull request #798 from Ayrx/add-backend-check-to-twofactor
Added backend check to twofactor primitives
Diffstat (limited to 'tests/hazmat/primitives/twofactor/test_hotp.py')
-rw-r--r-- | tests/hazmat/primitives/twofactor/test_hotp.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/hazmat/primitives/twofactor/test_hotp.py b/tests/hazmat/primitives/twofactor/test_hotp.py index bc907c9f..548c6264 100644 --- a/tests/hazmat/primitives/twofactor/test_hotp.py +++ b/tests/hazmat/primitives/twofactor/test_hotp.py @@ -17,7 +17,7 @@ import os import pytest -from cryptography.exceptions import InvalidToken +from cryptography.exceptions import InvalidToken, UnsupportedInterface from cryptography.hazmat.primitives.twofactor.hotp import HOTP from cryptography.hazmat.primitives import hashes from tests.utils import load_vectors_from_file, load_nist_vectors @@ -95,3 +95,12 @@ class TestHOTP(object): with pytest.raises(TypeError): HOTP(secret, b"foo", SHA1(), backend) + + +def test_invalid_backend(): + secret = b"12345678901234567890" + + pretend_backend = object() + + with pytest.raises(UnsupportedInterface): + HOTP(secret, 8, hashes.SHA1(), pretend_backend) |