fix: mirror current-year test finance lines
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user