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
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