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
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
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
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
def test_get_by_email(session): email = '*****@*****.**' session.add(Profile(email=email, password='******')) session.commit() assert Profile.get_by_email(email) is not None
def other_profile(free_profile, session): session.add(free_profile) session.commit() return Profile.get_by_email(free_profile.email)
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