Some checks failed
CI/CD Pipeline / Code Quality Checks (push) Failing after 5m5s
CI/CD Pipeline / Run Tests (push) Failing after 5m5s
CI/CD Pipeline / Build Docker Images (push) Has been skipped
CI/CD Pipeline / Push to Gitea Registry (push) Has been skipped
CI/CD Pipeline / Deploy to Server (push) Has been skipped
26 lines
796 B
Python
26 lines
796 B
Python
"""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)
|