From 3a7e06174766bfb40d64e16758543bdf313a134d Mon Sep 17 00:00:00 2001 From: Jacob Cassagnol <87133045+jcassagnol-public@users.noreply.github.com> Date: Tue, 9 Nov 2021 17:40:52 -0500 Subject: Added testcases for new lines in Util.py --- SCons/UtilTests.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/SCons/UtilTests.py b/SCons/UtilTests.py index 4417ba5..74ea6e9 100644 --- a/SCons/UtilTests.py +++ b/SCons/UtilTests.py @@ -47,6 +47,7 @@ from SCons.Util import ( Selector, WhereIs, _attempt_init_of_python_3_9_hash_object, + _attempt_get_hash_function, _get_hash_object, _set_allowed_viable_default_hashes, adjustixes, @@ -941,6 +942,16 @@ class FIPSHashTestCase(unittest.TestCase): self.sys_v4_8 = unittest.mock.Mock(version_info=v4_8) ############################### + def basic_failover_bad_hashlib_hash_init(self): + """Tests that if the hashing function is entirely missing from hashlib (hashlib returns None), + the hash init function returns None""" + assert _attempt_init_of_python_3_9_hash_object(None) == None + + def basic_failover_bad_hashlib_hash_get(self): + """Tests that if the hashing function is entirely missing from hashlib (hashlib returns None), + the hash get function returns None""" + assert _attempt_get_hash_function("nonexist", self.no_algorithms) == None + def test_usedforsecurity_flag_behavior(self): """Test usedforsecurity flag -> should be set to 'True' on older versions of python, and 'False' on Python >= 3.9""" for version, expected in { -- cgit v0.12