]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-14322: added test case for invalid update to hmac (#26636)
authorArjun <ccldarjun@icloud.com>
Sun, 25 Feb 2024 10:33:28 +0000 (02:33 -0800)
committerGitHub <noreply@github.com>
Sun, 25 Feb 2024 10:33:28 +0000 (03:33 -0700)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Lib/test/test_hmac.py

index a39a2c45ebc2e28e2254b1036d4ebe79dea3ecb5..1502fba9f3e8b8bf974c1caffecddba517af0972 100644 (file)
@@ -479,6 +479,14 @@ class SanityTestCase(unittest.TestCase):
             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')