test: adapt JSON export coverage on dev
All checks were successful
State Corp Backend CI/CD / Quality gate (pull_request) Successful in 3m40s
State Corp Backend CI/CD / Build linux/amd64 images once (pull_request) Has been skipped
State Corp Backend CI/CD / Release dev (pull_request) Has been skipped
State Corp Backend CI/CD / Refresh and release internal main (pull_request) Has been skipped
State Corp Backend CI/CD / Release customer main (pull_request) Has been skipped
All checks were successful
State Corp Backend CI/CD / Quality gate (pull_request) Successful in 3m40s
State Corp Backend CI/CD / Build linux/amd64 images once (pull_request) Has been skipped
State Corp Backend CI/CD / Release dev (pull_request) Has been skipped
State Corp Backend CI/CD / Refresh and release internal main (pull_request) Has been skipped
State Corp Backend CI/CD / Release customer main (pull_request) Has been skipped
This commit is contained in:
@@ -1096,9 +1096,13 @@ def _render_json_file(
|
|||||||
)
|
)
|
||||||
batch: list[tuple[str, int, str | None, str]] = []
|
batch: list[tuple[str, int, str | None, str]] = []
|
||||||
for position, row in enumerate(_iter_spooled_rows(row_spool_path)):
|
for position, row in enumerate(_iter_spooled_rows(row_spool_path)):
|
||||||
raw_okpo = row.pop("ОКПО", None)
|
raw_okpo = row.pop("ОКПО", None) or row.pop("okpo", None)
|
||||||
okpo = str(raw_okpo) if raw_okpo else None
|
okpo = str(raw_okpo) if raw_okpo else None
|
||||||
fallback = [row.get("ИНН"), row.get("ОГРН"), row.get("Наименование")]
|
fallback = [
|
||||||
|
row.get("ИНН") or row.get("inn"),
|
||||||
|
row.get("ОГРН") or row.get("ogrn"),
|
||||||
|
row.get("Наименование"),
|
||||||
|
]
|
||||||
if not any(fallback):
|
if not any(fallback):
|
||||||
fallback.append(row.get("uid"))
|
fallback.append(row.get("uid"))
|
||||||
group_key = json.dumps(
|
group_key = json.dumps(
|
||||||
|
|||||||
@@ -257,7 +257,10 @@ class SourceRecordExportApiTest(APITestCase):
|
|||||||
if artifact.source_group == "media_mentions"
|
if artifact.source_group == "media_mentions"
|
||||||
and artifact.file_format == "json"
|
and artifact.file_format == "json"
|
||||||
)
|
)
|
||||||
rows = json.loads(media_path.read_text(encoding="utf-8"))
|
rows = _source_records(
|
||||||
|
json.loads(media_path.read_text(encoding="utf-8")),
|
||||||
|
"media_mentions",
|
||||||
|
)
|
||||||
exported = next(row for row in rows if row["uid"] == str(mention.id))
|
exported = next(row for row in rows if row["uid"] == str(mention.id))
|
||||||
self.assertEqual(exported["record_date"], "2023-02-15")
|
self.assertEqual(exported["record_date"], "2023-02-15")
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
|||||||
Reference in New Issue
Block a user