Files
state-corp-backend/tests/apps/organization/factories.py
Aleksandr Meshchriakov 697ecb7d1c
Some checks failed
CI/CD Pipeline / Code Quality Checks (push) Failing after 3m50s
CI/CD Pipeline / Run Tests (push) Successful in 3m57s
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
Implement exchange imports and frontend reporting APIs
2026-04-07 16:31:04 +02:00

64 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 faker import Faker
from apps.organization.models import IndustryCluster, Organization, OrganizationType
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)