# Path: models/groups.py
# class Groups(bases.BaseModel):
# 
# Path: models/logins.py
# class Logins(bases.BaseModel):
#     def get_by_email(cls, email):
#     def is_valid_password(self, password):
#     def password(self):
#     def password(self, value):
#     def validate_email(self, key, address):  # pylint: disable=unused-argument,no-self-use
# 
# Path: models/memberships.py
# class Memberships(bases.BaseModel):
# 
# Path: models/profiles.py
# class Profiles(bases.BaseModel):
#     def get_by_email(cls, email):
#     def validate_email(self, key, address):  # pylint: disable=unused-argument,no-self-use


    from builtins import *  # pylint: disable=unused-wildcard-import,redefined-builtin,wildcard-import
from sqlalchemy.exc import IntegrityError
from models import groups, logins, memberships, profiles
    import sys
import warnings
import pytest
    # Unsaved profiles shouldn't be found
    assert profiles.Profiles.get_by_email('2c32@4fc0.beec') is None

    profile.save()

    # Now it can be found.
    assert profiles.Profiles.get_by_email('2c32@4fc0.beec') == profile

def test_login_relation(dbsession):  # pylint: disable=unused-argument
    """ Profiles can have a Logins relation. """
    profile = profiles.Profiles(full_name='4176898b 61d515c6e423', email='61b4@4a1d.9f2b')
    login = logins.Logins(password='104d4cec-9425-4e37-9de2-242c6d772eea')

    assert profile.login is None
    profile.login = login
    assert profile.login == login

def test_memberships_relation(dbsession):
    """ Profiles can have Memberships relations. """
    group1 = groups.Groups(name='dfe5cf8f-1da7-4b70-aefb-8236cd894c5d')
    membership1 = memberships.Memberships(group=group1)
    group2 = groups.Groups(name='3b821a0d-5313-4534-8f18-573845915e21')
    membership2 = memberships.Memberships(group=group2)
    profile = profiles.Profiles(full_name='61f7d724 7cab51d68b61', email='d90c@4e2f.85f4')
    profile.memberships += (membership1, membership2)

    profile.save()
    dbsession.commit()
    assert len(profile.memberships) == 2
    assert membership1 in profile.memberships

# Path: models/groups.py
# class Groups(bases.BaseModel):
# 
# Path: models/logins.py
# class Logins(bases.BaseModel):
#     def get_by_email(cls, email):
#     def is_valid_password(self, password):
#     def password(self):
#     def password(self, value):
#     def validate_email(self, key, address):  # pylint: disable=unused-argument,no-self-use
# 
# Path: models/memberships.py
# class Memberships(bases.BaseModel):
# 
# Path: models/profiles.py
# class Profiles(bases.BaseModel):
#     def get_by_email(cls, email):
#     def validate_email(self, key, address):  # pylint: disable=unused-argument,no-self-use


# Path: tests/models/test_profiles.py
    from builtins import *  # pylint: disable=unused-wildcard-import,redefined-builtin,wildcard-import
from sqlalchemy.exc import IntegrityError
from models import groups, logins, memberships, profiles
    import sys
import warnings
import pytest

    # Unsaved profiles shouldn't be found
    assert profiles.Profiles.get_by_email('2c32@4fc0.beec') is None

    profile.save()

    # Now it can be found.
    assert profiles.Profiles.get_by_email('2c32@4fc0.beec') == profile

def test_login_relation(dbsession):  # pylint: disable=unused-argument
    """ Profiles can have a Logins relation. """
    profile = profiles.Profiles(full_name='4176898b 61d515c6e423', email='61b4@4a1d.9f2b')
    login = logins.Logins(password='104d4cec-9425-4e37-9de2-242c6d772eea')

    assert profile.login is None
    profile.login = login
    assert profile.login == login

def test_memberships_relation(dbsession):
    """ Profiles can have Memberships relations. """
    group1 = groups.Groups(name='dfe5cf8f-1da7-4b70-aefb-8236cd894c5d')
    membership1 = memberships.Memberships(group=group1)
    group2 = groups.Groups(name='3b821a0d-5313-4534-8f18-573845915e21')
    membership2 = memberships.Memberships(group=group2)
    profile = profiles.Profiles(full_name='61f7d724 7cab51d68b61', email='d90c@4e2f.85f4')
    profile.memberships += (membership1, membership2)

    profile.save()
    dbsession.commit()
    assert len(profile.memberships) == 2
    assert membership1 in profile.memberships

    assert membership2 in profile.memberships