Files
state-corp-backend/tests/apps/organization/factories.py
Aleksandr Meshchriakov ee497bd557
Some checks failed
CI/CD Pipeline / Code Quality Checks (push) Successful in 1m53s
CI/CD Pipeline / Run Tests (push) Successful in 2m19s
CI/CD Pipeline / Build Docker Images (push) Successful in 3m26s
CI/CD Pipeline / Push to Gitea Registry (push) Failing after 20s
CI/CD Pipeline / Deploy to Server (push) Has been skipped
Fix Ruff import ordering for CI
2026-04-07 16:37:47 +02:00

63 lines
2.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Factories for organization app."""
import factory
from apps.organization.models import IndustryCluster, Organization, OrganizationType
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())
short_name = factory.LazyAttribute(lambda _: f"АО «{fake.company()}»")
organization_type = factory.LazyAttribute(
lambda _: fake.random_element(
[OrganizationType.AO, OrganizationType.PAO, OrganizationType.FGUP]
)
)
cluster = factory.LazyAttribute(
lambda _: fake.random_element(
[
IndustryCluster.RADIOELECTRONICS,
IndustryCluster.NUCLEAR,
IndustryCluster.SPACE,
]
)
)
inn = factory.LazyAttribute(lambda _: fake.numerify("##########"))
ogrn = factory.LazyAttribute(lambda _: fake.numerify("#############"))
kpp = factory.LazyAttribute(lambda _: fake.numerify("#########"))
okpo = factory.LazyAttribute(lambda _: fake.numerify("########"))
registration_date = factory.LazyAttribute(lambda _: fake.date_this_century())
legal_address = factory.LazyAttribute(lambda _: fake.address().replace("\n", ", "))
activity_type = factory.LazyAttribute(lambda _: fake.job())
founder_name = factory.LazyAttribute(lambda _: fake.company())
ownership_type = "Собственность государственных корпораций"
legal_form = "Акционерное общество"
charter_capital_amount = factory.LazyAttribute(
lambda _: fake.pydecimal(left_digits=9, right_digits=2, positive=True)
)
general_director_name = factory.LazyAttribute(lambda _: fake.name())
general_director_inn = factory.LazyAttribute(
lambda _: fake.numerify("############")
)
general_director_appointment_date = factory.LazyAttribute(
lambda _: fake.date_this_decade()
)
executors_count = factory.LazyAttribute(lambda _: fake.random_int(min=20, max=500))
financial_reports_available = True
tax_reports_available = True
in_defense_unreliable_suppliers_registry = False
in_275_fz_registry = False
bankruptcy_messages_found = False
@classmethod
def create_organization(cls, **kwargs):
"""Create organization with defaults."""
return cls.create(**kwargs)