def test_get_or_create(session, individual_contact): from dispatch.individual.service import create, get_by_email from dispatch.individual.models import IndividualContactCreate contact = get_by_email(db_session=session, email=individual_contact.email) if not contact: name = "Joe Smith" title = "Engineer" email = "*****@*****.**" mobile_phone = "111-111-1111" office_phone = "111-111-1111" weblink = "https://www.example.com/" individual_contact_in = IndividualContactCreate( name=name, title=title, email=email, mobile_phone=mobile_phone, office_phone=office_phone, weblink=weblink, ) individual_contact = create( db_session=session, individual_contact_in=individual_contact_in) contact = create(db_session=session, individual_contact_in=individual_contact_in) assert contact
def test_create(session, project): from dispatch.individual.service import create from dispatch.individual.models import IndividualContactCreate name = "Joe Smith" title = "Engineer" email = "*****@*****.**" mobile_phone = "111-111-1111" office_phone = "111-111-1111" weblink = "https://www.example.com/" individual_contact_in = IndividualContactCreate( name=name, title=title, email=email, mobile_phone=mobile_phone, office_phone=office_phone, weblink=weblink, project={ "id": project.id, "name": project.name }, ) individual_contact = create(db_session=session, individual_contact_in=individual_contact_in) assert individual_contact