コード例 #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