def test_confirm_invalid_user(db_session):
    with pytest.raises(us.InvalidUserError):
        us.confirm_user('*****@*****.**')
def test_confirm_already_confirmed_user(db_session):
    user = _create_user_data(db_session, confirmed=True)
    with pytest.raises(us.AlreadyConfirmedUserError):
        user = us.confirm_user(user.email)
def test_confirm_unconfirmed_user(db_session):
    user = _create_user_data(db_session, confirmed=False)
    user = us.confirm_user(user.email)
    assert user.confirmed