feat: expose FSSP source APIs and exports
This commit is contained in:
@@ -2,11 +2,13 @@
|
||||
|
||||
import json
|
||||
import os
|
||||
from io import StringIO
|
||||
from pathlib import Path
|
||||
from uuid import uuid4
|
||||
|
||||
import pytest
|
||||
from apps.parsers.budget_registry import normalize_budget_record
|
||||
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
|
||||
from apps.parsers.sro_membership import normalize_sro_membership
|
||||
@@ -108,7 +110,31 @@ def _canonical_records():
|
||||
lookup_value=organization.ogrn,
|
||||
),
|
||||
)
|
||||
return [budget, sme, sro], raw_budget
|
||||
fssp_org = Organization.objects.create(
|
||||
name="АО Проверка",
|
||||
inn="7707083893",
|
||||
ogrn="1027700132195",
|
||||
okpo="12345678",
|
||||
directory_imported_at=timezone.now(),
|
||||
opk_registry_membership=False,
|
||||
)
|
||||
csv_fixture = Path(__file__).parents[2] / "fixtures/fssp/general.csv"
|
||||
row = next(
|
||||
iter_fssp_records(StringIO(csv_fixture.read_text()), dataset=GENERAL_DATASET)
|
||||
)
|
||||
fssp = _create_record(
|
||||
fssp_org,
|
||||
FSSP_SOURCE,
|
||||
{
|
||||
"title": row.title,
|
||||
"record_date": row.record_date,
|
||||
"amount": row.amount,
|
||||
"status": row.status,
|
||||
"url": row.url,
|
||||
"payload": row.payload,
|
||||
},
|
||||
)
|
||||
return [budget, sme, sro, fssp], raw_budget
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@@ -129,8 +155,8 @@ def test_source_record_runtime_fixtures():
|
||||
return body
|
||||
|
||||
mixed = capture("mixed-list", "list", client.get(list_url))
|
||||
assert len(mixed["data"]) == 3
|
||||
assert mixed["meta"]["pagination"]["total_count"] == 3
|
||||
assert len(mixed["data"]) == 4
|
||||
assert mixed["meta"]["pagination"]["total_count"] == 4
|
||||
details = {}
|
||||
for record in records:
|
||||
listing = capture(
|
||||
|
||||
Reference in New Issue
Block a user