Repository URL to install this package:
|
Version:
0.1.4 ▾
|
# import faker, pytest
# from slugify import slugify
# from crm.models import activities, contacts, dynamic_fields, entries, entry_fields, in_charge_entries
# # from investment.tests.fixtures import random_currency
# fake = faker.Faker()
# @pytest.fixture
# def random_activity_type():
# return activities.ActivityType.objects.create(
# title=fake.word()
# )
# @pytest.fixture
# def random_activity():
# return activities.Activity.objects.create(
# title=fake.word()
# )
# @pytest.fixture
# def random_planned_activity():
# return activities.Activity.objects.create(
# title=fake.word(),
# status=activities.ActivityStatus.PLANNED.value,
# start=fake.past_date(start_date="-2d"),
# end=fake.future_datetime(end_date="+2d"),
# )
# @pytest.fixture
# def random_person_prefix():
# return entry_fields.PersonPrefix.objects.create(
# title=fake.text(max_nb_chars=10)
# )
# @pytest.fixture
# def random_company_type():
# return entry_fields.CompanyType.objects.create(
# title=fake.word()
# )
# @pytest.fixture
# def random_person():
# return entries.Person.objects.create(
# first_name=fake.first_name(),
# last_name=fake.last_name(),
# birthday=fake.date_this_year()
# )
# @pytest.fixture()
# def random_company():
# return entries.Company.objects.create(
# title=fake.word()
# )
# @pytest.fixture
# def random_tag():
# return entry_fields.Tag.objects.create(
# text=fake.word()
# )
# @pytest.fixture
# def random_entry_status():
# return entry_fields.EntryStatus.objects.create(
# title=fake.word()
# )
# @pytest.fixture
# def random_employee():
# status = entry_fields.EntryStatus.objects.create(
# title='Employee'
# )
# return entries.Person.objects.create(
# first_name=fake.first_name(),
# last_name=fake.last_name(),
# birthday=fake.date_this_year(),
# status=status
# )
# @pytest.fixture
# def random_contact_location():
# return contacts.ContactLocation.objects.create(
# location=fake.word()
# )
# @pytest.fixture
# def random_contact_telephone_type():
# return contacts.ContactTelephoneType.objects.create(
# telephone_type=fake.word()
# )
# @pytest.fixture
# def random_contact_country():
# return contacts.ContactCountry.objects.create(
# country_name=fake.word(),
# country_code=fake.word()[:3]
# )
# @pytest.fixture
# def random_banking_contact(primary=False, entry=None):
# if not entry:
# entry = random_person().get_casted_entry()
# return contacts.BankingContact.objects.create(
# primary=primary,
# location=random_contact_location(),
# entry=entry,
# institute=fake.word(),
# iban=fake.iban(),
# # currency=random_currency()
# )
# @pytest.fixture
# def random_address_contact(primary=False, entry=None):
# if not entry:
# entry = random_person().get_casted_entry()
# return contacts.AddressContact.objects.create(
# primary=primary,
# location=random_contact_location(),
# entry=entry,
# street=fake.street_name(),
# city=fake.city(),
# country=random_contact_country(),
# )
# @pytest.fixture
# def random_telephone_contact(primary=False, entry=None):
# if not entry:
# entry = random_person().get_casted_entry()
# return contacts.TelephoneContact.objects.create(
# primary=primary,
# location=random_contact_location(),
# entry=entry,
# number=fake.msisdn(),
# telephone_type=random_contact_telephone_type(),
# )
# @pytest.fixture
# def random_email_contact(primary=False, entry=None):
# if not entry:
# entry = random_person().get_casted_entry()
# return contacts.EmailContact.objects.create(
# primary=primary,
# location=random_contact_location(),
# entry=entry,
# address=fake.ascii_free_email(),
# )
# @pytest.fixture
# def random_website_contact(primary=False, entry=None):
# if not entry:
# entry = random_person().get_casted_entry()
# return contacts.WebsiteContact.objects.create(
# primary=primary,
# location=random_contact_location(),
# entry=entry,
# url=fake.url(),
# )
# @pytest.fixture
# def random_dynamic_char_field():
# return dynamic_fields.DynamicCharField.objects.create(
# title=fake.word()
# )
# @pytest.fixture
# def random_dynamic_range_field():
# return dynamic_fields.DynamicRangeField.objects.create(
# title=fake.word(),
# range_min=0,
# range_max=100,
# )
# @pytest.fixture
# def random_dynamic_choice_field():
# return dynamic_fields.DynamicChoiceField.objects.create(
# title=fake.word(),
# choices=[fake.word(), fake.word(), fake.word()],
# )
# @pytest.fixture
# def random_entry_in_charge_add_request():
# entry = random_person().get_casted_entry()
# employee = random_employee()
# return in_charge_entries.EntryInChargeRequest.objects.create(
# type=in_charge_entries.EntryInChargeRequestType.ADD.value,
# entry=entry,
# in_charge=employee,
# )
# @pytest.fixture
# def random_entry_in_charge_remove_request():
# entry = random_person().get_casted_entry()
# employee = random_employee()
# entry.in_charge.add(employee)
# return in_charge_entries.EntryInChargeRequest.objects.create(
# type=in_charge_entries.EntryInChargeRequestType.REMOVE.value,
# entry=entry,
# in_charge=employee,
# )