def test_valid_reset_token(self): u = Utente(password='******') db.session.add(u) db.session.commit() token = u.generate_reset_token() self.assertTrue(Utente.reset_password(token, 'dog')) self.assertTrue(u.verify_password('dog'))
def test_invalid_reset_token(self): u = Utente(password='******') db.session.add(u) db.session.commit() token = u.generate_reset_token() self.assertFalse(Utente.reset_password(token + 'a', 'horse')) self.assertTrue(u.verify_password('cat'))
def test_password_verification(self): u = Utente(password='******') self.assertTrue(u.verify_password('cat')) self.assertFalse(u.verify_password('dog'))