From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sun, 25 Feb 2024 10:52:55 +0000 (+0100) Subject: [3.11] bpo-14322: added test case for invalid update to hmac (GH-26636) (#115905) X-Git-Tag: v3.11.9~148 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c6455ff0fd4a05a5b7ffeccb19a9ae30c66ffbe6;p=thirdparty%2FPython%2Fcpython.git [3.11] bpo-14322: added test case for invalid update to hmac (GH-26636) (#115905) Co-authored-by: Arjun Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- diff --git a/Lib/test/test_hmac.py b/Lib/test/test_hmac.py index a39a2c45ebc2..1502fba9f3e8 100644 --- a/Lib/test/test_hmac.py +++ b/Lib/test/test_hmac.py @@ -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')