Files
state-corp-backend/tests/apps/organization/factories.py
Aleksandr Meshchriakov 9eb41f6fd4
All checks were successful
CI/CD Pipeline / Run Tests (push) Successful in 2m26s
CI/CD Pipeline / Code Quality Checks (push) Successful in 5m3s
CI/CD Pipeline / Build and Push Dev Images (push) Successful in 32s
CI/CD Pipeline / Deploy Dev via Compose (push) Successful in 31s
feat: address QA analytics and report upload feedback
2026-07-19 13:32:56 +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 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("########"))
mostovik_uid = factory.Faker("uuid4")
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)