Exemple #1
0
 def testSetHashConfigValueNotSupported(self):
     'Test using the default hasher when the configured value is not supported.'
     setConfigValue(self.setting, 'blowfish')
     expected = hashlib.sha256()
     actual = sethash.set_hash_function()()
     self.assertIsInstance(actual, type(expected))
Exemple #2
0
 def testSetHashConfigSha512(self):
     'Test using the default hasher from config file (sha512).'
     setConfigValue(self.setting, 'sha512')
     expected = hashlib.sha512()
     actual = sethash.set_hash_function()()
     self.assertIsInstance(actual, type(expected))
Exemple #3
0
 def tearDownModule(cls):
     'Restore the algorithm setting'
     setConfigValue(cls.setting, cls.saved_algorithm)
Exemple #4
0
 def tearDown(self):
     'Reset the value of the configured algorithm.'
     # If this is not reset, and 'blowfish' is the
     # setting that remains, testUseHasher will fail.
     setConfigValue(self.setting, self.saved_algorithm)
Exemple #5
0
 def setUpClass(cls):
     'Save the current algorithm setting.'
     cls.saved_algorithm = setConfigValue(cls.setting, '')