aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/twofactor/test_hotp.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hazmat/primitives/twofactor/test_hotp.py')
-rw-r--r--tests/hazmat/primitives/twofactor/test_hotp.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/hazmat/primitives/twofactor/test_hotp.py b/tests/hazmat/primitives/twofactor/test_hotp.py
index bc907c9f..0ef18979 100644
--- a/tests/hazmat/primitives/twofactor/test_hotp.py
+++ b/tests/hazmat/primitives/twofactor/test_hotp.py
@@ -15,9 +15,11 @@ from __future__ import absolute_import, division, print_function
import os
+import pretend
+
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 +97,12 @@ class TestHOTP(object):
with pytest.raises(TypeError):
HOTP(secret, b"foo", SHA1(), backend)
+
+
+def test_invalid_backend():
+ secret = b"12345678901234567890"
+
+ pretend_backend = pretend.stub()
+
+ with pytest.raises(UnsupportedInterface):
+ HOTP(secret, 8, hashes.SHA1(), pretend_backend)