def test_encodepasswordrandom(self): "Test that the random salt works correctly" reload(random) # Clear the mock # Two encodings of the same password will be different because the # salt will be a different random set of chars result1 = utils.encode_password("password") result2 = utils.encode_password("password") self.assertNotEqual(result1, result2)
def test_encodepassword(self): result = utils.encode_password("password") self.assertTrue(utils.check_password("password", result))
def set_password(self, password): self.password = utils.encode_password(password)