Ejemplo n.º 1
0
def test_valid_reset_token(mockdata):
    user = User(password='******')
    db.session.add(user)
    db.session.commit()
    token = user.generate_reset_token()
    assert user.reset_password(token, 'vegan bacon') is True
    assert user.verify_password('vegan bacon') is True
Ejemplo n.º 2
0
def test_invalid_reset_token(mockdata):
    user1 = User(password='******')
    user2 = User(password='******')
    db.session.add(user1)
    db.session.add(user2)
    db.session.commit()
    token = user1.generate_reset_token()
    assert user2.reset_password(token, 'tempeh') is False
    assert user2.verify_password('vegan bacon') is True
Ejemplo n.º 3
0
def test_password_verification_failure(mockdata):
    user = User(password='******')
    assert user.verify_password('vegan bacon') is False
Ejemplo n.º 4
0
def test_password_verification_success(mockdata):
    user = User(password='******')
    assert user.verify_password('bacon') is True