Example #1
0
def test_expired_confirmation_token(mockdata):
    user = User(password='******')
    db.session.add(user)
    db.session.commit()
    token = user.generate_confirmation_token(1)
    time.sleep(2)
    assert user.confirm(token) is False
Example #2
0
def test_invalid_confirmation_token(mockdata):
    user1 = User(password='******')
    user2 = User(password='******')
    db.session.add(user1)
    db.session.add(user2)
    db.session.commit()
    token = user1.generate_confirmation_token()
    assert user2.confirm(token) is False
Example #3
0
def test_valid_confirmation_token(mockdata):
    user = User(password='******')
    db.session.add(user)
    db.session.commit()
    token = user.generate_confirmation_token()
    assert user.confirm(token) is True