feat(registers): add command to generate test data from factories #11
@@ -18,9 +18,7 @@ from django.db.models import Max
|
|||||||
class Command(BaseAppCommand):
|
class Command(BaseAppCommand):
|
||||||
"""Генерирует тестовые данные для всех реестров на основе фабрик тестов."""
|
"""Генерирует тестовые данные для всех реестров на основе фабрик тестов."""
|
||||||
|
|
||||||
help = (
|
help = "Генерация тестовых данных для registers/parsers на основе фабрик из tests"
|
||||||
"Генерация тестовых данных для registers/parsers на основе фабрик из tests"
|
|
||||||
)
|
|
||||||
use_transaction = True
|
use_transaction = True
|
||||||
|
|
||||||
def add_arguments(self, parser) -> None:
|
def add_arguments(self, parser) -> None:
|
||||||
@@ -111,9 +109,7 @@ class Command(BaseAppCommand):
|
|||||||
)
|
)
|
||||||
|
|
||||||
for index in range(1, count + 1):
|
for index in range(1, count + 1):
|
||||||
procurement_factory.create(
|
procurement_factory.create(purchase_number=f"{run_seed:06d}{index:013d}")
|
||||||
purchase_number=f"{run_seed:06d}{index:013d}"
|
|
||||||
)
|
|
||||||
|
|
||||||
created_by_registry = {
|
created_by_registry = {
|
||||||
"industrial_certificates": count,
|
"industrial_certificates": count,
|
||||||
@@ -125,9 +121,7 @@ class Command(BaseAppCommand):
|
|||||||
|
|
||||||
self.log_info("Создание прокси и логов загрузок...")
|
self.log_info("Создание прокси и логов загрузок...")
|
||||||
for index in range(1, count + 1):
|
for index in range(1, count + 1):
|
||||||
proxy_factory.create(
|
proxy_factory.create(address=f"http://proxy-{run_token}-{index}.local:8080")
|
||||||
address=f"http://proxy-{run_token}-{index}.local:8080"
|
|
||||||
)
|
|
||||||
|
|
||||||
load_log_sources = [source for source, _ in ParserLoadLog.Source.choices]
|
load_log_sources = [source for source, _ in ParserLoadLog.Source.choices]
|
||||||
for source in load_log_sources:
|
for source in load_log_sources:
|
||||||
|
|||||||
@@ -69,3 +69,10 @@ CACHES = {
|
|||||||
|
|
||||||
# Email
|
# Email
|
||||||
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
||||||
|
|
||||||
|
# DRF: отключаем throttling в dev, чтобы не мешать фронту тестировать API.
|
||||||
|
REST_FRAMEWORK = {
|
||||||
|
**globals().get("REST_FRAMEWORK", {}),
|
||||||
|
"DEFAULT_THROTTLE_CLASSES": [],
|
||||||
|
"DEFAULT_THROTTLE_RATES": {},
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user