fix dashboard parser source counts
All checks were successful
CI/CD Pipeline / Manual Action Help (push) Has been skipped
CI/CD Pipeline / Start Dev Containers in Dokploy (push) Has been skipped
CI/CD Pipeline / Drop and Recreate Dev Database (push) Has been skipped
CI/CD Pipeline / Quality Gate (push) Successful in 1m12s
CI/CD Pipeline / Build and Push Images (push) Successful in 5m23s
CI/CD Pipeline / Internal Notify (push) Successful in 1s
CI/CD Pipeline / Deploy Dev in Dokploy (push) Successful in 1s

This commit is contained in:
2026-04-28 15:36:38 +02:00
parent 3392502449
commit 8b6313a504
2 changed files with 41 additions and 1 deletions

View File

@@ -158,6 +158,36 @@ class ParsersViewSetTest(APITestCase):
self.assertEqual(detail_response.data["data"]["payload"], {"registry": "44fz"})
def test_dashboard_data_exposes_source_groups_for_page(self):
GenericParserRecord.objects.create(
load_batch=1,
source=ParserLoadLog.Source.PROCUREMENTS_44FZ,
external_id="eis-44fz-1",
title="EIS 44-FZ notice 1",
payload={"registry": "44fz"},
)
GenericParserRecord.objects.create(
load_batch=1,
source=ParserLoadLog.Source.PROCUREMENTS_44FZ,
external_id="eis-44fz-2",
title="EIS 44-FZ notice 2",
payload={"registry": "44fz"},
)
GenericParserRecord.objects.create(
load_batch=1,
source=ParserLoadLog.Source.TRUDVSEM,
external_id="trudvsem-1",
title="Vacancy",
payload={"registry": "trudvsem"},
)
FinancialReport.objects.create(
external_id=_digits(5),
ogrn=_digits(13),
file_name=f"fin_{_digits(5)}_{_digits(13)}.xlsx",
file_hash=fake.sha256(raw_output=False),
load_batch=1,
status=FinancialReport.Status.SUCCESS,
source=FinancialReport.SourceType.API,
)
self.client.force_authenticate(self.user)
response = self.client.get("/api/v1/parsers/dashboard/")
@@ -182,6 +212,12 @@ class ParsersViewSetTest(APITestCase):
sources["contracts"]["result_list_url"],
"/api/v1/eis/contracts/",
)
self.assertEqual(
payload["source_counts"][ParserLoadLog.Source.PROCUREMENTS_44FZ],
2,
)
self.assertEqual(payload["source_counts"][ParserLoadLog.Source.TRUDVSEM], 1)
self.assertEqual(payload["source_counts"][ParserLoadLog.Source.FNS_REPORTS], 1)
def test_financial_reports_list_and_retrieve(self):
report = FinancialReport.objects.create(