86 lines
3.1 KiB
Python
86 lines
3.1 KiB
Python
"""Factories for external data models."""
|
||
|
||
import factory
|
||
from apps.external_data.models import (
|
||
ArbitrationCase,
|
||
IndustrialProduct,
|
||
ProsecutorCheck,
|
||
PublicProcurement,
|
||
InformationSecurityRegistryEntry,
|
||
)
|
||
from faker import Faker
|
||
|
||
from tests.apps.organization.factories import OrganizationFactory
|
||
|
||
fake = Faker("ru_RU")
|
||
|
||
|
||
class IndustrialProductFactory(factory.django.DjangoModelFactory):
|
||
class Meta:
|
||
model = IndustrialProduct
|
||
|
||
organization = factory.SubFactory(OrganizationFactory)
|
||
product_name = factory.LazyAttribute(lambda _: fake.sentence(nb_words=3))
|
||
product_class = "electronics"
|
||
okpd2_code = "26.51.53"
|
||
tnved_code = "9015.10"
|
||
registry_number = factory.Sequence(lambda n: f"{1000 + n}/2026")
|
||
|
||
|
||
class ProsecutorCheckFactory(factory.django.DjangoModelFactory):
|
||
class Meta:
|
||
model = ProsecutorCheck
|
||
|
||
organization = factory.SubFactory(OrganizationFactory)
|
||
registration_number = factory.Sequence(lambda n: f"{2_900_000_000 + n}")
|
||
law_type = "294_fz"
|
||
control_authority = "Центральное управление Ростехнадзора"
|
||
prosecutor_office = "Московская городская прокуратура"
|
||
start_date = factory.LazyAttribute(lambda _: fake.date_this_decade())
|
||
status = "planned"
|
||
|
||
|
||
class PublicProcurementFactory(factory.django.DjangoModelFactory):
|
||
class Meta:
|
||
model = PublicProcurement
|
||
|
||
organization = factory.SubFactory(OrganizationFactory)
|
||
purchase_number = factory.Sequence(lambda n: f"{37_310_000_000_000_0000 + n:019d}")
|
||
law_type = "44_fz"
|
||
status = "signing"
|
||
contract_amount = factory.LazyAttribute(
|
||
lambda _: fake.pydecimal(left_digits=8, right_digits=2, positive=True)
|
||
)
|
||
contract_date = factory.LazyAttribute(lambda _: fake.date_this_year())
|
||
execution_start_date = factory.LazyAttribute(lambda _: fake.date_this_year())
|
||
execution_end_date = factory.LazyAttribute(
|
||
lambda _: fake.date_between(start_date="+30d", end_date="+365d")
|
||
)
|
||
purchase_name = factory.LazyAttribute(lambda _: fake.sentence(nb_words=6))
|
||
|
||
|
||
class ArbitrationCaseFactory(factory.django.DjangoModelFactory):
|
||
class Meta:
|
||
model = ArbitrationCase
|
||
|
||
organization = factory.SubFactory(OrganizationFactory)
|
||
case_number = factory.Sequence(lambda n: f"А40-{16_000 + n}/2026")
|
||
court_name = "Арбитражный суд города Москвы"
|
||
party_role = "defendant"
|
||
status = "hearing_scheduled"
|
||
decision_date = factory.LazyAttribute(lambda _: fake.date_this_year())
|
||
|
||
|
||
class InformationSecurityRegistryEntryFactory(
|
||
factory.django.DjangoModelFactory
|
||
):
|
||
class Meta:
|
||
model = InformationSecurityRegistryEntry
|
||
|
||
organization = factory.SubFactory(OrganizationFactory)
|
||
registry_name = "Реестр лицензий на деятельность по технической защите конфиденциальной информации"
|
||
presence_status = "present"
|
||
entry_number = "77-001234"
|
||
issued_at = factory.LazyAttribute(lambda _: fake.date_this_year())
|
||
expires_at = factory.LazyAttribute(lambda _: fake.date_this_year())
|