test: adapt SRO JSON snapshot assertions
All checks were successful
Mostovik Backend CI/CD / Tests and lint (pull_request) Successful in 4m2s
Mostovik Backend CI/CD / Build linux/amd64 release images (pull_request) Has been skipped
Mostovik Backend CI/CD / Deploy dev (pull_request) Has been skipped
Mostovik Backend CI/CD / Deploy and verify internal main (pull_request) Has been skipped

This commit is contained in:
Aleksandr Meshchryakov
2026-09-27 10:39:01 +02:00
parent b4f3a21ad6
commit 25b6cd95a4

View File

@@ -220,7 +220,10 @@ def test_sro_export_keeps_all_years_and_identifier_strings(export_client, file_f
assert archive.namelist() == [f"sro-membership-check.{file_format}"]
content = archive.read(archive.namelist()[0])
if file_format == "json":
rows = json.loads(content)
organizations = json.loads(content)
assert len(organizations) == 1
assert organizations[0]["okpo"] == "00000001"
rows = organizations[0]["sro_membership"]
elif file_format == "csv":
rows = list(csv.DictReader(StringIO(content.decode("utf-8-sig"))))
else:
@@ -231,7 +234,10 @@ def test_sro_export_keeps_all_years_and_identifier_strings(export_client, file_f
assert len(rows) == 1
assert rows[0]["ИНН"] == "0012345678"
assert rows[0]["ОГРН"] == "0012345678901"
assert rows[0]["ОКПО"] == "00000001"
if file_format == "json":
assert "ОКПО" not in rows[0]
else:
assert rows[0]["ОКПО"] == "00000001"
def test_publication_during_render_retries_then_builds_latest_snapshot(export_client):