Esempio n. 1
0
 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'))