Example #1
0
 def test_expired_confirmation_token(self):
     u = User(password='******')
     db.session.add(u)
     db.session.commit()
     token = u.generate_token(expiration=1)
     time.sleep(2)
     self.assertFalse(u.confirm_registration(token))
Example #2
0
 def test_invalid_confirmation_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_registration(token))
Example #3
0
 def test_valid_confirmation_token(self):
     u = User(password='******')
     db.session.add(u)
     db.session.commit()
     token = u.generate_token()
     self.assertTrue(u.confirm_registration(token))