feat: expose Checko section APIs and completion counters
This commit is contained in:
@@ -8,6 +8,7 @@ from uuid import uuid4
|
||||
|
||||
import pytest
|
||||
from apps.parsers.budget_registry import normalize_budget_record
|
||||
from apps.parsers.checko_sections import collect_checko_section
|
||||
from apps.parsers.fssp_csv import FSSP_SOURCE, GENERAL_DATASET, iter_fssp_records
|
||||
from apps.parsers.models import ParserSourceArtifact
|
||||
from apps.parsers.sme_support import support_payload
|
||||
@@ -19,6 +20,7 @@ from organizations.models import Organization, OrganizationSourceRecord
|
||||
from organizations.source_groups import get_source_group_descriptor
|
||||
from rest_framework.test import APIClient
|
||||
|
||||
from tests.apps.parsers.test_checko_sections import client_with, fixture
|
||||
from tests.apps.parsers.test_registry_payload_contract import full_budget_fixture
|
||||
from tests.apps.parsers.test_registry_snapshots import _xml
|
||||
from tests.apps.user.factories import UserFactory
|
||||
@@ -134,7 +136,34 @@ def _canonical_records():
|
||||
"payload": row.payload,
|
||||
},
|
||||
)
|
||||
return [budget, sme, sro, fssp], raw_budget
|
||||
sections = []
|
||||
for source in ("checko_leasing", "checko_messages", "checko_licenses"):
|
||||
client = (
|
||||
client_with(fixture("license.json"))
|
||||
if source == "checko_licenses"
|
||||
else client_with(
|
||||
fixture("messages-page-1.json"), fixture("messages-page-2.json")
|
||||
)
|
||||
)
|
||||
row = next(collect_checko_section(client, organization=fssp_org, source=source))
|
||||
row.payload["upstream"]["future_nested"] = {
|
||||
"keep": [None, False, 0, {"unknown": "0007"}]
|
||||
}
|
||||
sections.append(
|
||||
_create_record(
|
||||
fssp_org,
|
||||
source,
|
||||
{
|
||||
"title": row.title,
|
||||
"record_date": row.record_date,
|
||||
"amount": None,
|
||||
"status": row.status,
|
||||
"url": row.url,
|
||||
"payload": row.payload,
|
||||
},
|
||||
)
|
||||
)
|
||||
return [budget, sme, sro, fssp, *sections], raw_budget
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@@ -155,8 +184,8 @@ def test_source_record_runtime_fixtures():
|
||||
return body
|
||||
|
||||
mixed = capture("mixed-list", "list", client.get(list_url))
|
||||
assert len(mixed["data"]) == 4
|
||||
assert mixed["meta"]["pagination"]["total_count"] == 4
|
||||
assert len(mixed["data"]) == 7
|
||||
assert mixed["meta"]["pagination"]["total_count"] == 7
|
||||
details = {}
|
||||
for record in records:
|
||||
listing = capture(
|
||||
|
||||
Reference in New Issue
Block a user