Repository URL to install this package:
|
Version:
0.1.4 ▾
|
import pytest
from django.core.management import call_command
from pytest_factoryboy import register
from crm.factories.contacts import (AddressContactFactory,
BankingContactFactory, EmailContactFactory,
TelephoneContactFactory,
WebsiteContactFactory)
from crm.factories.entries import (CompanyFactory, EmployerCompanyFactory,
PersonFactory, UnemployedPersonFactory)
@pytest.fixture(scope='session')
def django_db_setup(django_db_setup, django_db_blocker):
"""Runs the loaddata command from django
"""
with django_db_blocker.unblock():
call_command('loaddata', 'crm/fixtures/EntryType.yaml')
call_command('loaddata', 'crm/fixtures/PersonPrefix.yaml')
call_command('loaddata', 'crm/fixtures/ContactCountry.yaml')
call_command('loaddata', 'crm/fixtures/ContactLocation.yaml')
call_command('loaddata', 'crm/fixtures/ContactTelephoneType.yaml')
register(PersonFactory, 'person_without_contacts', banking=None, addresses=None, telephones=None, emails=None, websites=None)
register(PersonFactory, 'person')
register(UnemployedPersonFactory, 'umemployed_person')
register(CompanyFactory, 'company')
register(BankingContactFactory, 'banking_contact')
register(AddressContactFactory, 'address_contact')
register(TelephoneContactFactory, 'telephone_contact')
register(EmailContactFactory, 'email_contact')
register(WebsiteContactFactory, 'website_contact')