aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_hmac.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hazmat/primitives/test_hmac.py')
-rw-r--r--tests/hazmat/primitives/test_hmac.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/hazmat/primitives/test_hmac.py b/tests/hazmat/primitives/test_hmac.py
index e2b517ae..81d9ac86 100644
--- a/tests/hazmat/primitives/test_hmac.py
+++ b/tests/hazmat/primitives/test_hmac.py
@@ -32,22 +32,26 @@ class TestHMAC(object):
)
def test_hmac_reject_unicode(self, backend):
- h = hmac.HMAC(key=b"mykey", hash_cls=hashes.SHA1, backend=backend)
+ h = hmac.HMAC(key=b"mykey", digestmod=hashes.SHA1, backend=backend)
with pytest.raises(TypeError):
h.update(six.u("\u00FC"))
def test_base_hash_hexdigest_string_type(self, backend):
- h = hmac.HMAC(key=b"mykey", hash_cls=hashes.SHA1, backend=backend,
- data=b"")
+ h = hmac.HMAC(key=b"mykey", digestmod=hashes.SHA1, backend=backend,
+ msg=b"")
assert isinstance(h.hexdigest(), str)
+ def test_hmac_no_digestmod(self):
+ with pytest.raises(ValueError):
+ hmac.HMAC(key=b"shortkey")
+
class TestCopyHMAC(object):
def test_copy_backend_object(self):
pretend_hmac = pretend.stub(copy_ctx=lambda a: True)
pretend_backend = pretend.stub(hmacs=pretend_hmac)
pretend_ctx = pretend.stub()
- h = hmac.HMAC(b"key", hashes.SHA1, backend=pretend_backend,
+ h = hmac.HMAC(b"key", digestmod=hashes.SHA1, backend=pretend_backend,
ctx=pretend_ctx)
assert h._backend is pretend_backend
assert h.copy()._backend is pretend_backend