"""Factories for organization app.""" import factory from apps.organization.models import Organization from faker import Faker fake = Faker("ru_RU") class OrganizationFactory(factory.django.DjangoModelFactory): """Factory for Organization model.""" class Meta: model = Organization name = factory.LazyAttribute(lambda _: fake.company()) inn = factory.LazyAttribute(lambda _: fake.numerify("##########")) ogrn = factory.LazyAttribute(lambda _: fake.numerify("#############")) kpp = factory.LazyAttribute(lambda _: fake.numerify("#########")) okpo = factory.LazyAttribute(lambda _: fake.numerify("########")) @classmethod def create_organization(cls, **kwargs): """Create organization with defaults.""" return cls.create(**kwargs)