refactor(parsers): перенести тесты в ROOT_DIR/tests и синхронизировать контракты задач

- перенесены тесты parsers из src/apps/parsers/tests в tests/apps/parsers

- обновлены тесты задач под текущее поведение Celery (ошибки пробрасываются исключениями)

- убрана зависимость тестов от внешнего брокера через локальные eager-вызовы

- добавлены/уточнены фабрики и импорты для единой структуры тестов

- обновлены README и CHANGELOG с новым правилом размещения тестов и запуском
This commit is contained in:
2026-03-04 15:35:50 +01:00
parent 0738c53040
commit 052389d921
18 changed files with 657 additions and 284 deletions

View File

@@ -89,6 +89,13 @@ class IndustrialCertificateRecord(TimestampMixin, models.Model):
blank=True,
help_text=_("Дата выдачи сертификата"),
)
issue_date_normalized = models.DateField(
_("дата выдачи (нормализованная)"),
null=True,
blank=True,
db_index=True,
help_text=_("Нормализованная дата выдачи сертификата"),
)
certificate_number = models.CharField(
_("номер сертификата"),
max_length=100,
@@ -101,6 +108,13 @@ class IndustrialCertificateRecord(TimestampMixin, models.Model):
blank=True,
help_text=_("Дата окончания действия"),
)
expiry_date_normalized = models.DateField(
_("дата окончания (нормализованная)"),
null=True,
blank=True,
db_index=True,
help_text=_("Нормализованная дата окончания действия"),
)
certificate_file_url = models.TextField(
_("URL файла"),
blank=True,
@@ -122,6 +136,15 @@ class IndustrialCertificateRecord(TimestampMixin, models.Model):
db_index=True,
help_text=_("ОГРН организации"),
)
registry_organization = models.ForeignKey(
"registers.Organization",
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name="industrial_certificate_records",
verbose_name=_("организация из реестров"),
help_text=_("Связь с организацией из приложения реестров"),
)
class Meta:
db_table = "parsers_industrial_certificate"
@@ -176,6 +199,15 @@ class ManufacturerRecord(TimestampMixin, models.Model):
blank=True,
help_text=_("Юридический адрес организации"),
)
registry_organization = models.ForeignKey(
"registers.Organization",
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name="manufacturer_records",
verbose_name=_("организация из реестров"),
help_text=_("Связь с организацией из приложения реестров"),
)
class Meta:
db_table = "parsers_manufacturer"
@@ -305,12 +337,26 @@ class InspectionRecord(TimestampMixin, models.Model):
blank=True,
help_text=_("Дата начала проверки"),
)
start_date_normalized = models.DateField(
_("дата начала (нормализованная)"),
null=True,
blank=True,
db_index=True,
help_text=_("Нормализованная дата начала проверки"),
)
end_date = models.CharField(
_("дата окончания"),
max_length=20,
blank=True,
help_text=_("Дата окончания проверки"),
)
end_date_normalized = models.DateField(
_("дата окончания (нормализованная)"),
null=True,
blank=True,
db_index=True,
help_text=_("Нормализованная дата окончания проверки"),
)
status = models.CharField(
_("статус"),
max_length=100,
@@ -348,6 +394,15 @@ class InspectionRecord(TimestampMixin, models.Model):
blank=True,
help_text=_("Месяц, за который загружены данные"),
)
registry_organization = models.ForeignKey(
"registers.Organization",
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name="inspection_records",
verbose_name=_("организация из реестров"),
help_text=_("Связь с организацией из приложения реестров"),
)
class Meta:
db_table = "parsers_inspection"
@@ -423,6 +478,15 @@ class ProcurementRecord(TimestampMixin, models.Model):
blank=True,
help_text=_("Начальная (максимальная) цена контракта"),
)
max_price_amount = models.DecimalField(
_("НМЦ (число)"),
max_digits=20,
decimal_places=2,
null=True,
blank=True,
db_index=True,
help_text=_("Нормализованная числовая НМЦ"),
)
currency_code = models.CharField(
_("валюта"),
max_length=10,
@@ -441,12 +505,26 @@ class ProcurementRecord(TimestampMixin, models.Model):
blank=True,
help_text=_("Дата публикации извещения"),
)
publish_date_normalized = models.DateField(
_("дата публикации (нормализованная)"),
null=True,
blank=True,
db_index=True,
help_text=_("Нормализованная дата публикации извещения"),
)
end_date = models.CharField(
_("дата окончания"),
max_length=30,
blank=True,
help_text=_("Дата окончания подачи заявок"),
)
end_date_normalized = models.DateField(
_("дата окончания (нормализованная)"),
null=True,
blank=True,
db_index=True,
help_text=_("Нормализованная дата окончания подачи заявок"),
)
status = models.CharField(
_("статус"),
max_length=100,
@@ -492,6 +570,15 @@ class ProcurementRecord(TimestampMixin, models.Model):
blank=True,
help_text=_("Месяц, за который загружены данные"),
)
registry_organization = models.ForeignKey(
"registers.Organization",
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name="procurement_records",
verbose_name=_("организация из реестров"),
help_text=_("Связь с организацией из приложения реестров"),
)
class Meta:
db_table = "parsers_procurement"
@@ -546,6 +633,15 @@ class FinancialReport(TimestampMixin, models.Model):
db_index=True,
help_text=_("ОГРН организации"),
)
registry_organization = models.ForeignKey(
"registers.Organization",
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name="financial_reports",
verbose_name=_("организация из реестров"),
help_text=_("Связь с организацией из приложения реестров"),
)
file_name = models.CharField(
_("имя файла"),
max_length=255,