Esempio n. 1
0
 def testSetHashPassingAlgorithmMd5(self):
     'Test passing the md5 algorithm.'
     expected = hashlib.md5()
     actual = sethash.set_hash_function('md5')()
     self.assertIsInstance(actual, type(expected))
Esempio n. 2
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))
Esempio n. 3
0
 def testSetHashPassingAlgorithmSha1(self):
     'Test passing the sha1 algorithm.'
     expected = hashlib.sha1()
     actual = sethash.set_hash_function('sha1')()
     self.assertIsInstance(actual, type(expected))
Esempio n. 4
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))