Exemplo n.º 1
0
 def test_valid_email_change_token(self):
     u = User(email='*****@*****.**', password='******')
     db.session.add(u)
     db.session.commit()
     token = u.generate_email_change_token('*****@*****.**')
     self.assertTrue(u.change_email(token))
     self.assertTrue(u.email == '*****@*****.**')
Exemplo n.º 2
0
 def test_invalid_email_change_token(self):
     u1 = User(email='*****@*****.**', password='******')
     u2 = User(email='*****@*****.**', password='******')
     db.session.add(u1)
     db.session.add(u2)
     db.session.commit()
     token = u1.generate_email_change_token('*****@*****.**')
     self.assertFalse(u2.change_email(token))
     self.assertTrue(u2.email == '*****@*****.**')