feat: expand platform APIs, sources, and test coverage
Some checks failed
CI/CD Pipeline / Run Tests (pull_request) Successful in 1m53s
CI/CD Pipeline / Telegram Notify Success (push) Has been cancelled
CI/CD Pipeline / Run Tests (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (pull_request) Failing after 2m54s
CI/CD Pipeline / Telegram Notify Success (pull_request) Has been skipped
Some checks failed
CI/CD Pipeline / Run Tests (pull_request) Successful in 1m53s
CI/CD Pipeline / Telegram Notify Success (push) Has been cancelled
CI/CD Pipeline / Run Tests (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (pull_request) Failing after 2m54s
CI/CD Pipeline / Telegram Notify Success (pull_request) Has been skipped
This commit is contained in:
@@ -7,6 +7,7 @@ from datetime import timedelta
|
||||
import factory
|
||||
from apps.parsers.models import (
|
||||
IndustrialCertificateRecord,
|
||||
IndustrialProductRecord,
|
||||
InspectionRecord,
|
||||
ManufacturerRecord,
|
||||
ParserLoadLog,
|
||||
@@ -54,6 +55,11 @@ def generate_legal_address() -> str:
|
||||
return fake.address().replace("\n", ", ")
|
||||
|
||||
|
||||
def generate_registry_number() -> str:
|
||||
"""Генерация регистрационного номера записи."""
|
||||
return f"MPP-{_digits(8)}"
|
||||
|
||||
|
||||
def generate_proxy_address() -> str:
|
||||
"""Генерация адреса прокси."""
|
||||
return f"http://{fake.ipv4()}:{fake.port_number()}"
|
||||
@@ -163,6 +169,26 @@ class ManufacturerRecordFactory(factory.django.DjangoModelFactory):
|
||||
address = factory.LazyFunction(generate_legal_address)
|
||||
|
||||
|
||||
class IndustrialProductRecordFactory(factory.django.DjangoModelFactory):
|
||||
"""Factory for IndustrialProductRecord model."""
|
||||
|
||||
class Meta:
|
||||
model = IndustrialProductRecord
|
||||
|
||||
load_batch = factory.Sequence(lambda n: n + 1)
|
||||
full_organisation_name = factory.LazyFunction(generate_company_name)
|
||||
ogrn = factory.LazyFunction(generate_ogrn)
|
||||
inn = factory.LazyFunction(generate_inn_legal)
|
||||
registry_number = factory.LazyFunction(generate_registry_number)
|
||||
product_name = factory.LazyAttribute(lambda _: fake.sentence(nb_words=4))
|
||||
product_model = factory.LazyAttribute(lambda _: fake.bothify(text="MODEL-###"))
|
||||
okpd2_code = factory.LazyAttribute(
|
||||
lambda _: f"{fake.random_int(min=10, max=99)}.{fake.random_int(min=10, max=99)}"
|
||||
)
|
||||
tnved_code = factory.LazyAttribute(lambda _: _digits(10))
|
||||
regulatory_document = factory.LazyAttribute(lambda _: fake.sentence(nb_words=5))
|
||||
|
||||
|
||||
class InspectionRecordFactory(factory.django.DjangoModelFactory):
|
||||
"""Factory for InspectionRecord model."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user