bpo-14322: added test case for invalid update to hmac (#26636)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This commit is contained in:
Arjun 2024-02-25 02:33:28 -08:00 committed by GitHub
parent a00b41b9e9
commit 6550b54813
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -479,6 +479,14 @@ def test_exercise_all_methods(self):
self.fail("Exception raised during normal usage of HMAC class.")
class UpdateTestCase(unittest.TestCase):
@hashlib_helper.requires_hashdigest('sha256')
def test_with_str_update(self):
with self.assertRaises(TypeError):
h = hmac.new(b"key", digestmod='sha256')
h.update("invalid update")
class CopyTestCase(unittest.TestCase):
@hashlib_helper.requires_hashdigest('sha256')