예제 #1
0
def profile(session):
    """Registered but not authenticated in system Profile"""
    raw_password = '******'

    p = Profile(email='*****@*****.**', password=raw_password, name='John')
    session.add(p)
    session.commit()

    profile = Profile.get_by_email(p.email)
    profile.raw_password = raw_password
    return profile
예제 #2
0
def test_successful_registration(register, free_profile, session):
    res = register(email=free_profile.email,
                   password=free_profile.raw_password,
                   confirm=free_profile.raw_password,
                   name=free_profile.name,
                   birth_date=free_profile.birth_date)
    assert res.status_code == status_codes.REDIRECT, res.data.decode('utf-8')

    profile = Profile.get_by_email(free_profile.email)
    assert profile.name == free_profile.name
    assert profile.birth_date == free_profile.birth_date
예제 #3
0
def current_user(session, client, login):
    """Registered and authenticated profile"""
    email = '*****@*****.**'
    password = '******'
    birth_date = datetime.today() - timedelta(days=1)
    session.add(Profile(email=email, password=password, name='current_user',
                        birth_date=birth_date.date()))
    session.commit()
    login(email, password=password)
    current_user = Profile.get_by_email(email)
    current_user.raw_password = password
    return current_user
예제 #4
0
def profile_with_best_friend(session, profile):
    """Registered profiles with best friend"""
    raw_password = '******'
    email = '*****@*****.**'
    p = Profile(email=email,
                password=raw_password,
                name='Profile with best friend')
    p.send_request(profile)
    profile.confirm_request(p)
    p.set_best_friend(profile)
    session.commit()
    p = Profile.get_by_email(email)
    p.raw_password = raw_password
    return p
예제 #5
0
def test_get_by_email(session):
    email = '*****@*****.**'
    session.add(Profile(email=email, password='******'))
    session.commit()
    assert Profile.get_by_email(email) is not None
예제 #6
0
def other_profile(free_profile, session):
    session.add(free_profile)
    session.commit()
    return Profile.get_by_email(free_profile.email)
예제 #7
0
def test_get_by_email_none_for_empty_value(session):
    assert Profile.get_by_email(None) is None
    assert Profile.get_by_email('') is None