fix: accept nullable message publishers and scoped dev SPB trust
Some checks failed
Mostovik Backend CI/CD / Tests and lint (push) Successful in 3m3s
Mostovik Backend CI/CD / Deploy dev (push) Has been cancelled
Mostovik Backend CI/CD / Deploy and verify internal main (push) Has been cancelled
Mostovik Backend CI/CD / Build linux/amd64 release images (push) Has been cancelled

This commit is contained in:
Aleksandr Meshchryakov
2026-10-05 19:23:03 +02:00
parent 0dd763109b
commit 1a82345ab3
13 changed files with 131 additions and 15 deletions

View File

@@ -177,7 +177,7 @@ def test_overlapping_pages_cannot_prove_total_before_leasing_filter(source):
response["data"]["ЗапВсего"] = 4
with pytest.raises(SnapshotValidationError) as error:
collect(client_with(first, second), source)
assert str(error.value.__cause__) == "incomplete_checko_record_count"
assert str(error.value) == "incomplete_checko_record_count"
def test_license_unknown_raw_fields_survive():
@@ -200,3 +200,23 @@ def test_malformed_license_section_rejected(value):
response["data"]["Лиценз"] = value
with pytest.raises(SnapshotValidationError):
collect(client_with(response), "checko_licenses")
@pytest.mark.parametrize("source", ["checko_messages", "checko_leasing"])
def test_nullable_publisher_keeps_message_when_canonical_subject_is_participant(source):
first = fixture("messages-page-1.json")
first["data"]["Записи"][0]["Публикатор"] = None
rows = collect(client_with(first, fixture("messages-page-2.json")), source)
assert rows[0].payload["publisher_identifier"] is None
assert rows[0].payload["participant_identifiers"] == [ORG.inn]
assert rows[0].payload["upstream"]["Публикатор"] is None
def test_nullable_publisher_does_not_admit_message_for_another_subject():
first = fixture("messages-page-1.json")
first["data"]["Записи"][0]["Публикатор"] = None
first["data"]["Записи"][0]["Участники"] = ["0000000000"]
with pytest.raises(
SnapshotValidationError, match="^checko_message_subject_mismatch$"
):
collect(client_with(first, fixture("messages-page-2.json")))