def test_is_sha256(self): valid_hash = '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08' self.assertTrue(is_sha256(valid_hash)) invalid_hash = 'notarealhash' self.assertFalse(is_sha256(invalid_hash)) invalid_hash = '---' self.assertFalse(is_sha256(invalid_hash))
def test_sha256(self): result1 = sha256("test") result2 = sha256("test2") ans1 = '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08' ans2 = '60303ae22b998861bce3b28f33eec1be758a213c86c93c076dbe9f558c11c752' self.assertEqual(result1, ans1) self.assertEqual(result2, ans2) self.assertTrue(is_sha256(result1)) self.assertTrue(is_sha256(result2))