feat(registers): add command to generate test data from factories #11

Merged
avm merged 2 commits from feature/registers-generate-test-data-command into dev 2026-03-20 12:59:17 +03:00
2 changed files with 10 additions and 9 deletions
Showing only changes of commit 46e6e24934 - Show all commits

View File

@@ -18,9 +18,7 @@ from django.db.models import Max
class Command(BaseAppCommand):
"""Генерирует тестовые данные для всех реестров на основе фабрик тестов."""
help = (
"Генерация тестовых данных для registers/parsers на основе фабрик из tests"
)
help = "Генерация тестовых данных для registers/parsers на основе фабрик из tests"
use_transaction = True
def add_arguments(self, parser) -> None:
@@ -111,9 +109,7 @@ class Command(BaseAppCommand):
)
for index in range(1, count + 1):
procurement_factory.create(
purchase_number=f"{run_seed:06d}{index:013d}"
)
procurement_factory.create(purchase_number=f"{run_seed:06d}{index:013d}")
created_by_registry = {
"industrial_certificates": count,
@@ -125,9 +121,7 @@ class Command(BaseAppCommand):
self.log_info("Создание прокси и логов загрузок...")
for index in range(1, count + 1):
proxy_factory.create(
address=f"http://proxy-{run_token}-{index}.local:8080"
)
proxy_factory.create(address=f"http://proxy-{run_token}-{index}.local:8080")
load_log_sources = [source for source, _ in ParserLoadLog.Source.choices]
for source in load_log_sources:

View File

@@ -69,3 +69,10 @@ CACHES = {
# Email
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
# DRF: отключаем throttling в dev, чтобы не мешать фронту тестировать API.
REST_FRAMEWORK = {
**globals().get("REST_FRAMEWORK", {}),
"DEFAULT_THROTTLE_CLASSES": [],
"DEFAULT_THROTTLE_RATES": {},
}