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.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/twofactor/test_hotp.py b/tests/hazmat/primitives/twofactor/test_hotp.py
index ab5f93c5..14cb08a8 100644
--- a/tests/hazmat/primitives/twofactor/test_hotp.py
+++ b/tests/hazmat/primitives/twofactor/test_hotp.py
@@ -35,6 +35,10 @@ class TestHOTP(object):
with pytest.raises(ValueError):
HOTP(secret, 6, SHA1(), backend)
+ def test_unenforced_invalid_kwy_length(self, backend):
+ secret = os.urandom(10)
+ HOTP(secret, 6, SHA1(), backend, enforce_key_length=False)
+
def test_invalid_hotp_length(self, backend):
secret = os.urandom(16)
@@ -105,6 +109,11 @@ class TestHOTP(object):
"GNBVGY3TQOJQGEZDGNBVGY3TQOJQ&algorithm=SHA1&issuer=Foo"
"&counter=1")
+ def test_buffer_protocol(self, backend):
+ key = bytearray(b"a long key with lots of entropy goes here")
+ hotp = HOTP(key, 6, SHA1(), backend)
+ assert hotp.generate(10) == b"559978"
+
def test_invalid_backend():
secret = b"12345678901234567890"