Exemplo n.º 1
0
 def test_valid_reset_token(self):
     u = User(password='******')
     db.session.add(u)
     db.session.commit()
     token = u.generate_token()
     self.assertTrue(u.confirm_reset(token, 'dog'))
     self.assertTrue(u.verify_password('dog'))
Exemplo n.º 2
0
 def test_invalid_reset_token(self):
     u1 = User(password='******')
     u2 = User(password='******')
     db.session.add(u1)
     db.session.add(u2)
     db.session.commit()
     token = u1.generate_token()
     self.assertFalse(u2.confirm_reset(token, 'horse'))
     self.assertTrue(u2.verify_password('dog'))
Exemplo n.º 3
0
 def test_password_verification(self):
     u = User(password='******')
     self.assertTrue(u.verify_password('cat'))
     self.assertFalse(u.verify_password('dog'))