fix: mirror current-year test finance lines
All checks were successful
CI/CD Pipeline / Quality Gate (push) Successful in 33s
CI/CD Pipeline / Build and Push Images (push) Successful in 20s
CI/CD Pipeline / Internal Notify (push) Successful in 0s
CI/CD Pipeline / Deploy Dev via Compose (push) Successful in 23s

This commit is contained in:
2026-08-09 13:10:57 +02:00
parent 2d990ccf6a
commit 5618155503
2 changed files with 47 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ from io import StringIO
from apps.exchange.state_corp_services import StateCorpExchangeService
from apps.parsers.models import (
FinancialReport,
FinancialReportLine,
GenericParserRecord,
IndustrialCertificateRecord,
IndustrialProductRecord,
@@ -103,6 +104,11 @@ class TestCompaniesCommandsTest(TestCase):
self.assertEqual(InspectionRecord.objects.count(), 20)
self.assertEqual(ProcurementRecord.objects.count(), 20)
self.assertEqual(FinancialReport.objects.count(), 20)
self.assertEqual(FinancialReportLine.objects.count(), 20 * 4)
self.assertEqual(
set(FinancialReportLine.objects.values_list("year", flat=True)),
{timezone.localdate().year},
)
self.assertEqual(GenericParserRecord.objects.count(), 20 * 9)
def test_create_updates_the_fixed_dataset_without_duplicates(self):
@@ -151,6 +157,12 @@ class TestCompaniesCommandsTest(TestCase):
.values_list("inn", flat=True)
)
package = StateCorpExchangeService.build_package(organization_inns=company_inns)
reports = StateCorpExchangeService._serialize_financial_reports(
{
organization.ogrn: organization.inn
for organization in Organization.objects.filter(inn__in=company_inns)
}
)
self.assertEqual(
package.payload_counts,
@@ -169,6 +181,16 @@ class TestCompaniesCommandsTest(TestCase):
"labor_vacancies": 20,
},
)
self.assertEqual(len(reports), 20)
self.assertEqual(sum(len(report["lines"]) for report in reports), 80)
self.assertEqual(
{
line["year"]
for report in reports
for line in report["lines"]
},
{timezone.localdate().year},
)
def test_delete_removes_only_the_fixed_twenty_companies(self):
untouched = Organization.objects.create(